#ifndef V_COMMIT_HASH #define V_COMMIT_HASH "45ae01d23168b6372f734eeb38a77360bbcf184a" #endif #define V_USE_SIGNAL_H // V comptime_definitions: // V compile time defines by -d or -define flags: // All custom defines : no_backtrace,linux // Turned ON custom defines: no_backtrace,linux #define CUSTOM_DEFINE_no_backtrace #define CUSTOM_DEFINE_linux // V typedefs: typedef struct IError IError; typedef struct none none; // BEGIN_array_fixed_return_typedefs typedef struct _v_Array_fixed_string_11 _v_Array_fixed_string_11; typedef struct _v_Array_fixed_voidptr_11 _v_Array_fixed_voidptr_11; typedef struct _v_Array_fixed_u8_128 _v_Array_fixed_u8_128; typedef struct _v_Array_fixed_f64_4 _v_Array_fixed_f64_4; typedef struct _v_Array_fixed_u8_32 _v_Array_fixed_u8_32; typedef struct _v_Array_fixed_u8_64 _v_Array_fixed_u8_64; typedef struct _v_Array_fixed_u8_5 _v_Array_fixed_u8_5; typedef struct _v_Array_fixed_u8_20 _v_Array_fixed_u8_20; typedef struct _v_Array_fixed_u8_15 _v_Array_fixed_u8_15; typedef struct _v_Array_fixed_u8_6 _v_Array_fixed_u8_6; typedef struct _v_Array_fixed_u8_256 _v_Array_fixed_u8_256; typedef struct _v_Array_fixed_u64_309 _v_Array_fixed_u64_309; typedef struct _v_Array_fixed_u64_324 _v_Array_fixed_u64_324; typedef struct _v_Array_fixed_u32_10 _v_Array_fixed_u32_10; typedef struct _v_Array_fixed_u64_20 _v_Array_fixed_u64_20; typedef struct _v_Array_fixed_u64_584 _v_Array_fixed_u64_584; typedef struct _v_Array_fixed_u64_652 _v_Array_fixed_u64_652; typedef struct _v_Array_fixed_f64_36 _v_Array_fixed_f64_36; typedef struct _v_Array_fixed_u8_26 _v_Array_fixed_u8_26; typedef struct _v_Array_fixed_u8_512 _v_Array_fixed_u8_512; typedef struct _v_Array_fixed_u64_47 _v_Array_fixed_u64_47; typedef struct _v_Array_fixed_u64_31 _v_Array_fixed_u64_31; typedef struct _v_Array_fixed_int_64 _v_Array_fixed_int_64; typedef struct _v_Array_fixed_voidptr_64 _v_Array_fixed_voidptr_64; typedef struct _v_Array_fixed_u8_17 _v_Array_fixed_u8_17; typedef struct _v_Array_fixed_i32_1264 _v_Array_fixed_i32_1264; typedef struct _v_Array_fixed_int_10 _v_Array_fixed_int_10; typedef struct _v_Array_fixed_int_20 _v_Array_fixed_int_20; // END_array_fixed_return_typedefs // BEGIN_multi_return_typedefs typedef struct multi_return_u32_u32 multi_return_u32_u32; typedef struct multi_return_string_string multi_return_string_string; typedef struct multi_return_int_int multi_return_int_int; typedef struct multi_return_rune_int multi_return_rune_int; typedef struct multi_return_u32_u32_u32 multi_return_u32_u32_u32; typedef struct multi_return_strconv__ParserState_strconv__PrepNumber multi_return_strconv__ParserState_strconv__PrepNumber; typedef struct multi_return_u64_int multi_return_u64_int; typedef struct multi_return_i64_int multi_return_i64_int; typedef struct multi_return_strconv__Dec32_bool multi_return_strconv__Dec32_bool; typedef struct multi_return_strconv__Dec64_bool multi_return_strconv__Dec64_bool; typedef struct multi_return_f64_int multi_return_f64_int; typedef struct multi_return_i64_i64_i64 multi_return_i64_i64_i64; typedef struct multi_return_f64_f64 multi_return_f64_f64; typedef struct multi_return_u64_u64 multi_return_u64_u64; // END_multi_return_typedefs typedef struct strings__IndentParam strings__IndentParam; typedef struct builtin__closure__ClosurePage builtin__closure__ClosurePage; typedef struct builtin__closure__ClosureLiveInfo builtin__closure__ClosureLiveInfo; typedef struct builtin__closure__ClosureLifetimeRecord builtin__closure__ClosureLifetimeRecord; typedef struct builtin__closure__ClosureLifetimeFrame builtin__closure__ClosureLifetimeFrame; typedef struct builtin__closure__ClosureLifetimeState builtin__closure__ClosureLifetimeState; typedef struct builtin__closure__Lifetime builtin__closure__Lifetime; typedef struct builtin__closure__FrameToken builtin__closure__FrameToken; typedef struct builtin__closure__Closure builtin__closure__Closure; typedef struct builtin__closure__ClosureMutex builtin__closure__ClosureMutex; typedef struct strconv__AtoF64Param strconv__AtoF64Param; typedef struct strconv__BF_param strconv__BF_param; typedef struct strconv__PrepNumber strconv__PrepNumber; typedef struct strconv__Dec32 strconv__Dec32; typedef struct strconv__Dec64 strconv__Dec64; typedef struct strconv__Uint128 strconv__Uint128; typedef union strconv__Uf32 strconv__Uf32; typedef union strconv__Uf64 strconv__Uf64; typedef union strconv__Float64u strconv__Float64u; typedef union strconv__Float32u strconv__Float32u; typedef struct GCHeapUsage GCHeapUsage; typedef struct array array; typedef struct ArrayDataHeader ArrayDataHeader; typedef struct _result _result; typedef struct Error Error; typedef struct MessageError MessageError; typedef struct _option _option; typedef struct None__ None__; typedef struct GraphemeState GraphemeState; typedef struct InputRuneIterator InputRuneIterator; typedef struct DenseArray DenseArray; typedef struct map map; typedef struct VAssertMetaInfo VAssertMetaInfo; typedef struct SortedMap SortedMap; typedef struct mapnode mapnode; typedef struct string string; typedef struct RepIndex RepIndex; typedef struct WrapConfig WrapConfig; typedef struct RunesIterator RunesIterator; typedef union StrIntpMem StrIntpMem; typedef struct StrIntpData StrIntpData; typedef struct ToWideConfig ToWideConfig; typedef struct math__BezierPoint math__BezierPoint; typedef struct math__DigitParams math__DigitParams; typedef struct math__DivResult math__DivResult; typedef struct math__ChebSeries math__ChebSeries; typedef union math__U32_F32 math__U32_F32; typedef union math__U64_F64 math__U64_F64; typedef struct _result_int _result_int; typedef struct _result_builtin__closure__ClosureLifetimeState_ptr _result_builtin__closure__ClosureLifetimeState_ptr; typedef struct _result_builtin__closure__FrameToken _result_builtin__closure__FrameToken; typedef struct _result_void _result_void; typedef struct _result_f64 _result_f64; typedef struct _result_u64 _result_u64; typedef struct _result_i64 _result_i64; typedef struct _result_multi_return_i64_int _result_multi_return_i64_int; typedef struct _result_i8 _result_i8; typedef struct _result_i16 _result_i16; typedef struct _result_i32 _result_i32; typedef struct _result_u8 _result_u8; typedef struct _result_u16 _result_u16; typedef struct _result_u32 _result_u32; typedef struct _result_rune _result_rune; typedef struct _result_string _result_string; typedef struct _option_builtin__closure__ClosureLiveInfo _option_builtin__closure__ClosureLiveInfo; typedef struct _option_builtin__closure__ClosureLifetimeState_ptr _option_builtin__closure__ClosureLifetimeState_ptr; typedef struct _option_rune _option_rune; typedef struct _option_multi_return_string_string _option_multi_return_string_string; typedef struct _option_int _option_int; typedef struct _option_u8 _option_u8; // V preincludes: #define _GNU_SOURCE #if defined(__TINYC__) && defined(__has_include) // tcc does not support has_include properly yet, turn it off completely #undef __has_include #endif #if defined(__TINYC__) && defined(__BIONIC__) #define __builtin_nanf(ignored_string) (0.0F / 0.0F) #define __builtin_nan(ignored_string) (0.0 / 0.0) #define __builtin_nanl(ignored_string) (0.0L / 0.0L) #define __builtin_inff() (1.0F / 0.0F) #define __builtin_inf() (1.0 / 0.0) #define __builtin_infl() (1.0L / 0.0L) #define __builtin_huge_valf() (1.0F / 0.0F) #define __builtin_huge_val() (1.0 / 0.0) #define __builtin_huge_vall() (1.0L / 0.0L) #endif // V cheaders: // Generated by the V compiler #if defined __GNUC__ && __GNUC__ >= 14 #pragma GCC diagnostic warning "-Wimplicit-function-declaration" #pragma GCC diagnostic warning "-Wincompatible-pointer-types" #pragma GCC diagnostic warning "-Wint-conversion" #pragma GCC diagnostic warning "-Wreturn-mismatch" #endif #if defined(__TINYC__) && defined(__has_include) // tcc does not support has_include properly yet, turn it off completely #undef __has_include #endif #if defined(__TINYC__) && defined(__BIONIC__) #define __builtin_nanf(ignored_string) (0.0F / 0.0F) #define __builtin_nan(ignored_string) (0.0 / 0.0) #define __builtin_nanl(ignored_string) (0.0L / 0.0L) #define __builtin_inff() (1.0F / 0.0F) #define __builtin_inf() (1.0 / 0.0) #define __builtin_infl() (1.0L / 0.0L) #define __builtin_huge_valf() (1.0F / 0.0F) #define __builtin_huge_val() (1.0 / 0.0) #define __builtin_huge_vall() (1.0L / 0.0L) #endif #ifdef __TINYC__ #include #else #if defined(__has_include) #if __has_include() #include #elif __has_include() #include #else #error VERROR_MESSAGE The C compiler can not find . Please install the package `build-essential`. #endif #else #include #endif #endif #ifdef __TINYC__ #include #else #if defined(__has_include) #if __has_include() #include #else #error VERROR_MESSAGE The C compiler can not find . Please install the package `build-essential`. #endif #else #include #endif #endif //================================== builtin types ================================*/ #if defined(__x86_64__) || defined(_M_AMD64) || defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) || (defined(__riscv_xlen) && __riscv_xlen == 64) || defined(__s390x__) || (defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)) || defined(__loongarch64) || defined(__sparc__) || (defined(__powerpc64__) && defined(__BIG_ENDIAN__)) typedef int64_t vint_t; #else typedef int32_t vint_t; #endif typedef int64_t i64; typedef int16_t i16; typedef int8_t i8; typedef uint64_t u64; typedef uint32_t u32; typedef uint8_t u8; typedef uint16_t u16; typedef u8 byte; typedef int32_t i32; typedef uint32_t rune; typedef size_t usize; typedef ptrdiff_t isize; #ifndef VNOFLOAT typedef float f32; typedef double f64; #else typedef int32_t f32; typedef int64_t f64; #endif typedef int64_t int_literal; #ifndef VNOFLOAT typedef double float_literal; #else typedef int64_t float_literal; #endif typedef unsigned char* byteptr; typedef void* voidptr; typedef char* charptr; typedef u8 array_fixed_byte_300 [300]; typedef struct sync__Channel* chan; #ifndef CUSTOM_DEFINE_no_bool #ifndef __cplusplus #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L #ifndef bool #ifdef CUSTOM_DEFINE_4bytebool typedef int bool; #else typedef u8 bool; #endif #define true 1 #define false 0 #endif #endif #endif #endif #define V_SAFE_SHIFT_BITS(type) ((u64)(sizeof(type) * 8)) #define V_SAFE_LSHIFT_UNSIGNED(name, type) static inline type name(type x, u64 y) { return y >= V_SAFE_SHIFT_BITS(type) ? (type)0 : (type)(x << y); } #define V_SAFE_LSHIFT_SIGNED(name, type, unsigned_type) static inline type name(type x, u64 y) { return y >= V_SAFE_SHIFT_BITS(type) ? (type)0 : (type)(((unsigned_type)x) << y); } #define V_SAFE_RSHIFT_UNSIGNED(name, type) static inline type name(type x, u64 y) { return y >= V_SAFE_SHIFT_BITS(type) ? (type)0 : (type)(x >> y); } #define V_SAFE_RSHIFT_SIGNED(name, type) static inline type name(type x, u64 y) { return y >= V_SAFE_SHIFT_BITS(type) ? (type)(x < 0 ? -1 : 0) : (type)(x >> y); } V_SAFE_LSHIFT_SIGNED(v__lshift_char, char, u8) V_SAFE_RSHIFT_SIGNED(v__rshift_char, char) V_SAFE_LSHIFT_SIGNED(v__lshift_i8, i8, u8) V_SAFE_RSHIFT_SIGNED(v__rshift_i8, i8) V_SAFE_LSHIFT_SIGNED(v__lshift_i16, i16, u16) V_SAFE_RSHIFT_SIGNED(v__rshift_i16, i16) V_SAFE_LSHIFT_SIGNED(v__lshift_i32, i32, u32) V_SAFE_RSHIFT_SIGNED(v__rshift_i32, i32) V_SAFE_LSHIFT_SIGNED(v__lshift_int, int, unsigned int) V_SAFE_RSHIFT_SIGNED(v__rshift_int, int) V_SAFE_LSHIFT_SIGNED(v__lshift_vint_t, vint_t, u64) V_SAFE_RSHIFT_SIGNED(v__rshift_vint_t, vint_t) V_SAFE_LSHIFT_SIGNED(v__lshift_i64, i64, u64) V_SAFE_RSHIFT_SIGNED(v__rshift_i64, i64) V_SAFE_LSHIFT_SIGNED(v__lshift_isize, isize, usize) V_SAFE_RSHIFT_SIGNED(v__rshift_isize, isize) V_SAFE_LSHIFT_UNSIGNED(v__lshift_u8, u8) V_SAFE_RSHIFT_UNSIGNED(v__rshift_u8, u8) V_SAFE_LSHIFT_UNSIGNED(v__lshift_u16, u16) V_SAFE_RSHIFT_UNSIGNED(v__rshift_u16, u16) V_SAFE_LSHIFT_UNSIGNED(v__lshift_u32, u32) V_SAFE_RSHIFT_UNSIGNED(v__rshift_u32, u32) V_SAFE_LSHIFT_UNSIGNED(v__lshift_u64, u64) V_SAFE_RSHIFT_UNSIGNED(v__rshift_u64, u64) V_SAFE_LSHIFT_UNSIGNED(v__lshift_usize, usize) V_SAFE_RSHIFT_UNSIGNED(v__rshift_usize, usize) V_SAFE_LSHIFT_UNSIGNED(v__lshift_rune, rune) V_SAFE_RSHIFT_UNSIGNED(v__rshift_rune, rune) V_SAFE_LSHIFT_SIGNED(v__lshift_int_literal, int_literal, u64) V_SAFE_RSHIFT_SIGNED(v__rshift_int_literal, int_literal) #undef V_SAFE_RSHIFT_SIGNED #undef V_SAFE_RSHIFT_UNSIGNED #undef V_SAFE_LSHIFT_SIGNED #undef V_SAFE_LSHIFT_UNSIGNED #undef V_SAFE_SHIFT_BITS typedef u64 (*MapHashFn)(voidptr); typedef bool (*MapEqFn)(voidptr, voidptr); typedef void (*MapCloneFn)(voidptr, voidptr); typedef void (*MapFreeFn)(voidptr); //============================== HELPER C MACROS =============================*/ // _SLIT0 is used as NULL string for literal arguments // `"" s` is used to enforce a string literal argument #define _SLIT0 (string){.str=(byteptr)(""), .len=0, .is_lit=1} #define _S(s) ((string){.str=(byteptr)("" s), .len=(sizeof(s)-1), .is_lit=1}) #define _SLEN(s, n) ((string){.str=(byteptr)("" s), .len=n, .is_lit=1}) // optimized way to compare literal strings #define _SLIT_EQ(sptr, slen, lit) (slen == sizeof("" lit)-1 && !builtin__vmemcmp(sptr, "" lit, slen)) #define _SLIT_NE(sptr, slen, lit) (slen != sizeof("" lit)-1 || builtin__vmemcmp(sptr, "" lit, slen)) // take the address of an rvalue #define ADDR(type, expr) (&((type[]){expr}[0])) // copy something to the heap #define HEAP(type, expr) ((type*)builtin__memdup((void*)&((type[]){expr}[0]), sizeof(type))) #define HEAP_noscan(type, expr) ((type*)builtin__memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type))) #define HEAP_align(type, expr, align) ((type*)builtin__memdup_align((void*)&((type[]){expr}[0]), sizeof(type), align)) #define HEAP_vgc(type, expr, ptrmap, nptrs) ((type*)builtin__vgc_memdup_typed((void*)&((type[]){expr}[0]), sizeof(type), (ptrmap), (nptrs))) #define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); builtin__array_push_many(arr, tmp.data, tmp.len);} #define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); builtin__array_push_many_noscan(arr, tmp.data, tmp.len);} #define E_STRUCT_DECL #define E_STRUCT #define __NOINLINE __attribute__((noinline)) #define __IRQHANDLER __attribute__((interrupt)) #define __V_architecture 0 #if defined(__x86_64__) || defined(_M_AMD64) #define __V_amd64 1 #undef __V_architecture #define __V_architecture 1 #endif #if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) #define __V_arm64 1 #undef __V_architecture #define __V_architecture 2 #endif #if defined(__arm__) || defined(_M_ARM) #define __V_arm32 1 #undef __V_architecture #define __V_architecture 3 #endif #if defined(__riscv) && __riscv_xlen == 64 #define __V_rv64 1 #undef __V_architecture #define __V_architecture 4 #endif #if defined(__riscv) && __riscv_xlen == 32 #define __V_rv32 1 #undef __V_architecture #define __V_architecture 5 #endif #if defined(__i386__) || defined(_M_IX86) #define __V_x86 1 #undef __V_architecture #define __V_architecture 6 #endif #if defined(__s390x__) #define __V_s390x 1 #undef __V_architecture #define __V_architecture 7 #endif #if defined(__powerpc64__) && defined(__LITTLE_ENDIAN__) #define __V_ppc64le 1 #undef __V_architecture #define __V_architecture 8 #endif #if defined(__loongarch64) #define __V_loongarch64 1 #undef __V_architecture #define __V_architecture 9 #endif #if defined(__sparc__) #define __V_sparc64 1 #undef __V_architecture #define __V_architecture 10 #endif #if defined(__powerpc64__) && defined(__BIG_ENDIAN__) #define __V_ppc64 1 #undef __V_architecture #define __V_architecture 11 #endif #if (defined(__powerpc__) || defined(__powerpc) || defined(__POWERPC__) || defined(__ppc__) || defined(__ppc) || defined(__PPC__)) && !defined(__powerpc64__) && !defined(__ppc64__) && !defined(__PPC64__) #define __V_ppc 1 #undef __V_architecture #define __V_architecture 12 #endif // Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too: #ifdef __GNUC__ #define __V_GCC__ #endif #ifdef __TINYC__ #undef __V_GCC__ #endif #ifdef __cplusplus #undef __V_GCC__ #endif #ifdef __clang__ #undef __V_GCC__ #endif #ifdef _MSC_VER #undef __V_GCC__ #undef E_STRUCT_DECL #undef E_STRUCT #define E_STRUCT_DECL unsigned char _dummy_pad #define E_STRUCT 0 #endif #if defined(__has_include) && !defined(__TINYC__) #if __has_include() && !defined(_WIN32) #define __V_HAVE_EXECINFO_H 1 #include #else // On linux: int backtrace(void **__array, int __size); // On BSD: size_t backtrace(void **, size_t); #endif #elif (defined(__linux__) && (defined(__GLIBC__) || defined(__GNU_LIBRARY__))) || defined(__APPLE__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) #define __V_HAVE_EXECINFO_H 1 #include #else // On linux: int backtrace(void **__array, int __size); // On BSD: size_t backtrace(void **, size_t); #endif #ifndef __V_HAVE_EXECINFO_H #ifdef __cplusplus extern "C" { #endif int backtrace(void **__array, int __size); char **backtrace_symbols(void *const *__array, int __size); void backtrace_symbols_fd(void *const *__array, int __size, int __fd); #ifdef __cplusplus } #endif #endif #ifdef __TINYC__ #define _Atomic volatile #undef E_STRUCT_DECL #undef E_STRUCT #define E_STRUCT_DECL unsigned char _dummy_pad #define E_STRUCT 0 #undef __NOINLINE #undef __IRQHANDLER // tcc does not support inlining at all #define __NOINLINE #define __IRQHANDLER // #include int tcc_backtrace(const char *fmt, ...); #endif // Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB: #ifndef __offsetof_ptr #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr)) #endif // for __offset_of #ifndef __offsetof #if defined(__TINYC__) || defined(_MSC_VER) #define __offsetof(PTYPE,FIELDNAME) ((size_t)(&((PTYPE *)0)->FIELDNAME)) #else #define __offsetof(st, m) __builtin_offsetof(st, m) #endif #endif #if defined(_WIN32) || defined(__CYGWIN__) #define VV_EXP extern __declspec(dllexport) #ifdef _VPARALLELCC #define VV_LOC #else #define VV_LOC static #endif #else // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions, // and does not support __has_attribute(visibility) ... #ifndef __has_attribute #define __has_attribute(x) 0 // Compatibility with non-clang compilers. #endif #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility)) #ifdef ARM #define VV_EXP extern __attribute__((externally_visible,visibility("default"))) #else #define VV_EXP extern __attribute__((visibility("default"))) #endif #if defined(_VOBJECTFILE) || (defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))) #define VV_LOC static #else #define VV_LOC __attribute__ ((visibility ("hidden"))) #endif #else #define VV_EXP extern #ifdef _VPARALLELCC #define VV_LOC #else #define VV_LOC static #endif #endif #endif #ifdef __cplusplus #include #define _MOV std::move #else #define _MOV #endif #if defined(__TINYC__) && defined(__has_include) // tcc does not support has_include properly yet, turn it off completely #undef __has_include #endif //likely and unlikely macros #if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__) #define _likely_(x) __builtin_expect(x,1) #define _unlikely_(x) __builtin_expect(x,0) #else #define _likely_(x) (x) #define _unlikely_(x) (x) #endif #if !defined(VCALLCONV) #ifdef _MSC_VER #define VCALLCONV(name) __##name #else #define VCALLCONV(name) __attribute__((name)) #endif #endif // c_headers typedef int (*qsort_callback_func)(const void*, const void*); #if defined(_MSC_VER) && !defined(__clang__) #define V_CRT_LINKAGE __declspec(dllimport) #define V_CRT_CALL VCALLCONV(cdecl) #else #define V_CRT_LINKAGE #define V_CRT_CALL #endif #if (defined(_MSC_VER) && !defined(__clang__)) || defined(__cplusplus) // Under C++ (g++/clang++), let libc declare FILE/stdio/string/stdlib to keep // noexcept specifiers consistent — the manual extern "C" prototypes below // would otherwise conflict with system headers under -std=c++NN. #include #include #include #include #ifndef va_copy #define va_copy(dest, src) ((dest) = (src)) #endif #ifndef _TRUNCATE #define _TRUNCATE ((size_t)-1) #endif #elif defined(__NetBSD__) // NetBSD exposes stdin/stdout/stderr as macros into a single `__sF[3]` // array whose element size (sizeof(FILE)) depends on the platform and libc // version, so we cannot forward-declare them. The FreeBSD-style // `__stdinp/__stdoutp/__stderrp` symbols also do not exist on NetBSD (see // vlang/v#27190). Defer to the system headers for FILE, the stdio streams, // and the libc prototypes that would otherwise clash with the // `__restrict`-qualified declarations in NetBSD libc. #include #include #include #include #elif defined(__TINYC__) && (defined(__FreeBSD__) || defined(__OpenBSD__)) // TinyCC reports a hard redefinition error if system OpenSSL pulls in // after V has provided its own va_start macro. Include it first, // but keep V manual FILE declarations on these BSD libc variants. #include #if defined(__FreeBSD__) typedef struct __sFILE FILE; extern FILE* __stdinp; extern FILE* __stdoutp; extern FILE* __stderrp; #define stdin __stdinp #define stdout __stdoutp #define stderr __stderrp #else typedef struct __sFILE FILE; #ifndef _STDFILES_DECLARED #define _STDFILES_DECLARED struct __sFstub { long _stub; }; extern struct __sFstub __stdin[]; extern struct __sFstub __stdout[]; extern struct __sFstub __stderr[]; #endif #define stdin ((struct __sFILE *)__stdin) #define stdout ((struct __sFILE *)__stdout) #define stderr ((struct __sFILE *)__stderr) #endif #elif (defined(__MINGW32__) || defined(__MINGW64__)) && defined(__V_GCC__) // mingw-w64 stdio.h provides fprintf/vfprintf as static inline overrides // when __USE_MINGW_ANSI_STDIO is enabled, so use the system declarations // instead of the manual formatted-stdio prototypes below. #include #include #elif defined(__MINGW32__) || defined(__MINGW64__) || (defined(__clang__) && (defined(_WIN32) || defined(_WIN64))) typedef struct _iobuf FILE; FILE* __cdecl __acrt_iob_func(unsigned index); #define stdin (__acrt_iob_func(0)) #define stdout (__acrt_iob_func(1)) #define stderr (__acrt_iob_func(2)) #elif defined(__TINYC__) && (defined(_WIN32) || defined(_WIN64)) #ifndef _FILE_DEFINED struct _iobuf { char *_ptr; int _cnt; char *_base; int _flag; int _file; int _charbuf; int _bufsiz; char *_tmpfname; }; typedef struct _iobuf FILE; #define _FILE_DEFINED #endif #if defined(_WIN64) FILE* __cdecl __iob_func(void); #else #ifdef _MSVCRT_ extern FILE _iob[]; #define __iob_func() (_iob) #else extern FILE (*_imp___iob)[]; #define __iob_func() (*_imp___iob) #define _iob __iob_func() #endif #endif #define stdin (&__iob_func()[0]) #define stdout (&__iob_func()[1]) #define stderr (&__iob_func()[2]) #elif defined(__vinix__) typedef struct __file FILE; extern FILE* stdin; extern FILE* stdout; extern FILE* stderr; struct __thread_data; struct __threadattr; // pthread_t handling for vinix builds: // - Vinix kernel (freestanding, __STDC_HOSTED__=0): no libc, define // pthread_t ourselves so V code that references it compiles. // - util-vinix cross-compiled on a libc-providing host (hosted, e.g. // glibc on Linux or macOS with -D__vinix__): pull pthread_t from // libc to avoid colliding with the libc typedef. #if defined(__STDC_HOSTED__) && __STDC_HOSTED__ && defined(__has_include) && __has_include() #include #else typedef struct __thread_data *pthread_t; #endif typedef __builtin_va_list va_list; #ifndef va_start #define va_start(ap, v) __builtin_va_start(ap, v) #endif #ifndef va_arg #define va_arg(ap, t) __builtin_va_arg(ap, t) #endif #ifndef va_end #define va_end(ap) __builtin_va_end(ap) #endif #ifndef va_copy #define va_copy(dest, src) __builtin_va_copy(dest, src) #endif #else #if defined(__APPLE__) || defined(__FreeBSD__) typedef struct __sFILE FILE; extern FILE* __stdinp; extern FILE* __stdoutp; extern FILE* __stderrp; #define stdin __stdinp #define stdout __stdoutp #define stderr __stderrp #elif defined(__DragonFly__) typedef struct __sFILE FILE; extern FILE* __stdinp; extern FILE* __stdoutp; extern FILE* __stderrp; #define stdin __stdinp #define stdout __stdoutp #define stderr __stderrp #elif defined(__OpenBSD__) typedef struct __sFILE FILE; #ifndef _STDFILES_DECLARED #define _STDFILES_DECLARED struct __sFstub { long _stub; }; extern struct __sFstub __stdin[]; extern struct __sFstub __stdout[]; extern struct __sFstub __stderr[]; #endif #define stdin ((struct __sFILE *)__stdin) #define stdout ((struct __sFILE *)__stdout) #define stderr ((struct __sFILE *)__stderr) #elif defined(__BIONIC__) struct __sFILE; typedef struct __sFILE FILE; extern FILE* stdin; extern FILE* stdout; extern FILE* stderr; #elif defined(__linux__) && !defined(__GLIBC__) && !defined(__GNU_LIBRARY__) && !defined(__BIONIC__) && !defined(__UCLIBC__) typedef struct _IO_FILE FILE; // musl exposes the stdio streams as `FILE *const`, so match that to stay // compatible with later includes from headers like miniz.h. extern FILE* const stdin; extern FILE* const stdout; extern FILE* const stderr; #else typedef struct _IO_FILE FILE; extern FILE* stdin; extern FILE* stdout; extern FILE* stderr; #endif typedef __builtin_va_list va_list; #ifndef va_start #define va_start(ap, v) __builtin_va_start(ap, v) #endif #ifndef va_arg #define va_arg(ap, t) __builtin_va_arg(ap, t) #endif #ifndef va_end #define va_end(ap) __builtin_va_end(ap) #endif #ifndef va_copy #define va_copy(dest, src) __builtin_va_copy(dest, src) #endif #endif #if (!defined(_MSC_VER) || defined(__clang__)) && !defined(__cplusplus) && !defined(__NetBSD__) // mingw-w64 stdio.h declares these as static __mingw_ovr inline overrides // when __USE_MINGW_ANSI_STDIO is on. Skip them under gcc+mingw to avoid // static-after-extern conflicts; clang+mingw needs them because it builds // with -Werror=implicit-function-declaration and does not hit the conflict. // NetBSD pulls these prototypes from // via // the include block above to avoid `__restrict` qualifier conflicts. #if !((defined(__MINGW32__) || defined(__MINGW64__)) && !defined(__clang__)) V_CRT_LINKAGE int V_CRT_CALL vfprintf(FILE *stream, const char *format, va_list ap); V_CRT_LINKAGE int V_CRT_CALL vsnprintf(char *str, size_t size, const char *format, va_list ap); V_CRT_LINKAGE int V_CRT_CALL fprintf(FILE *stream, const char *format, ...); V_CRT_LINKAGE int V_CRT_CALL printf(const char *format, ...); V_CRT_LINKAGE int V_CRT_CALL snprintf(char *str, size_t size, const char *format, ...); V_CRT_LINKAGE int V_CRT_CALL sprintf(char *str, const char *format, ...); V_CRT_LINKAGE int V_CRT_CALL sscanf(const char *str, const char *format, ...); V_CRT_LINKAGE int V_CRT_CALL scanf(const char *format, ...); #endif V_CRT_LINKAGE int V_CRT_CALL puts(const char *str); V_CRT_LINKAGE void V_CRT_CALL perror(const char *str); V_CRT_LINKAGE int V_CRT_CALL fputs(const char *str, FILE *stream); V_CRT_LINKAGE int V_CRT_CALL getchar(void); V_CRT_LINKAGE int V_CRT_CALL putchar(int ch); V_CRT_LINKAGE int V_CRT_CALL getc(FILE *stream); V_CRT_LINKAGE int V_CRT_CALL fgetc(FILE *stream); V_CRT_LINKAGE int V_CRT_CALL ungetc(int ch, FILE *stream); V_CRT_LINKAGE int V_CRT_CALL fflush(FILE *stream); V_CRT_LINKAGE int V_CRT_CALL feof(FILE *stream); V_CRT_LINKAGE int V_CRT_CALL ferror(FILE *stream); V_CRT_LINKAGE void V_CRT_CALL clearerr(FILE *stream); V_CRT_LINKAGE int V_CRT_CALL setvbuf(FILE *stream, char *buf, int mode, size_t size); V_CRT_LINKAGE long V_CRT_CALL ftell(FILE *stream); V_CRT_LINKAGE void V_CRT_CALL rewind(FILE *stream); V_CRT_LINKAGE FILE * V_CRT_CALL fopen(const char *filename, const char *mode); V_CRT_LINKAGE FILE * V_CRT_CALL fdopen(int fd, const char *mode); V_CRT_LINKAGE FILE * V_CRT_CALL freopen(const char *filename, const char *mode, FILE *stream); V_CRT_LINKAGE int V_CRT_CALL fileno(FILE *stream); V_CRT_LINKAGE size_t V_CRT_CALL fread(void *ptr, size_t size, size_t items, FILE *stream); V_CRT_LINKAGE size_t V_CRT_CALL fwrite(const void *ptr, size_t size, size_t items, FILE *stream); #if defined(__vinix__) V_CRT_LINKAGE char * V_CRT_CALL fgets(char *str, size_t size, FILE *stream); #else V_CRT_LINKAGE char * V_CRT_CALL fgets(char *str, int size, FILE *stream); #endif V_CRT_LINKAGE int V_CRT_CALL fclose(FILE *stream); #if defined(__vinix__) V_CRT_LINKAGE FILE * V_CRT_CALL popen(char *command, char *mode); #else V_CRT_LINKAGE FILE * V_CRT_CALL popen(const char *command, const char *mode); #endif V_CRT_LINKAGE int V_CRT_CALL pclose(FILE *stream); V_CRT_LINKAGE void * V_CRT_CALL malloc(size_t size); V_CRT_LINKAGE void * V_CRT_CALL calloc(size_t nitems, size_t size); V_CRT_LINKAGE void * V_CRT_CALL realloc(void *ptr, size_t size); V_CRT_LINKAGE void * V_CRT_CALL aligned_alloc(size_t alignment, size_t size); V_CRT_LINKAGE int V_CRT_CALL posix_memalign(void **memptr, size_t alignment, size_t size); V_CRT_LINKAGE void V_CRT_CALL free(void *ptr); V_CRT_LINKAGE int V_CRT_CALL rand(void); V_CRT_LINKAGE void V_CRT_CALL srand(unsigned int seed); V_CRT_LINKAGE int V_CRT_CALL atexit(void (*cb)(void)); V_CRT_LINKAGE void V_CRT_CALL exit(int status); V_CRT_LINKAGE int V_CRT_CALL abs(int n); V_CRT_LINKAGE int V_CRT_CALL atoi(const char *str); V_CRT_LINKAGE double V_CRT_CALL atof(const char *str); V_CRT_LINKAGE char * V_CRT_CALL getenv(const char *name); V_CRT_LINKAGE int V_CRT_CALL setenv(const char *name, const char *value, int overwrite); V_CRT_LINKAGE int V_CRT_CALL unsetenv(const char *name); V_CRT_LINKAGE int V_CRT_CALL system(const char *command); V_CRT_LINKAGE int V_CRT_CALL remove(const char *path); V_CRT_LINKAGE int V_CRT_CALL rename(const char *old_path, const char *new_path); V_CRT_LINKAGE char * V_CRT_CALL realpath(const char *path, char *resolved_path); V_CRT_LINKAGE int V_CRT_CALL mkstemp(char *stemplate); V_CRT_LINKAGE void V_CRT_CALL qsort(void *base, size_t items, size_t item_size, qsort_callback_func cb); #if defined(__vinix__) V_CRT_LINKAGE int V_CRT_CALL strcmp(char *left, char *right); V_CRT_LINKAGE int V_CRT_CALL strncmp(char *left, char *right, size_t n); #else V_CRT_LINKAGE int V_CRT_CALL strcmp(const char *left, const char *right); V_CRT_LINKAGE int V_CRT_CALL strncmp(const char *left, const char *right, size_t n); #endif #if !defined(_WIN32) && !defined(_WIN64) && !defined(__BIONIC__) V_CRT_LINKAGE char * V_CRT_CALL strdup(const char *str); #endif #if !defined(_WIN32) && !defined(_WIN64) V_CRT_LINKAGE int V_CRT_CALL strcasecmp(const char *left, const char *right); V_CRT_LINKAGE int V_CRT_CALL strncasecmp(const char *left, const char *right, size_t n); #endif #if defined(__vinix__) V_CRT_LINKAGE size_t V_CRT_CALL strlen(char *str); #else V_CRT_LINKAGE size_t V_CRT_CALL strlen(const char *str); #endif V_CRT_LINKAGE char * V_CRT_CALL strerror(int errnum); V_CRT_LINKAGE void * V_CRT_CALL memcpy(void *dest, const void *src, size_t n); V_CRT_LINKAGE void * V_CRT_CALL memmove(void *dest, const void *src, size_t n); V_CRT_LINKAGE void * V_CRT_CALL memset(void *dest, int ch, size_t n); V_CRT_LINKAGE int V_CRT_CALL memcmp(const void *left, const void *right, size_t n); V_CRT_LINKAGE void * V_CRT_CALL memchr(const void *str, int c, size_t n); V_CRT_LINKAGE char * V_CRT_CALL strchr(const char *str, int c); V_CRT_LINKAGE char * V_CRT_CALL strrchr(const char *str, int c); V_CRT_LINKAGE char * V_CRT_CALL strstr(const char *haystack, const char *needle); V_CRT_LINKAGE int V_CRT_CALL fseek(FILE *stream, long offset, int whence); V_CRT_LINKAGE isize V_CRT_CALL getline(char **lineptr, size_t *n, FILE *stream); #if defined(_WIN32) || defined(_WIN64) V_CRT_LINKAGE int V_CRT_CALL _fileno(FILE *stream); V_CRT_LINKAGE FILE * V_CRT_CALL _wfopen(const unsigned short *filename, const unsigned short *mode); V_CRT_LINKAGE int V_CRT_CALL _wremove(const unsigned short *path); V_CRT_LINKAGE void * V_CRT_CALL _aligned_malloc(size_t size, size_t alignment); V_CRT_LINKAGE void * V_CRT_CALL _aligned_realloc(void *memory, size_t size, size_t alignment); V_CRT_LINKAGE void V_CRT_CALL _aligned_free(void *memory); V_CRT_LINKAGE unsigned short * V_CRT_CALL _wgetenv(const unsigned short *varname); V_CRT_LINKAGE int V_CRT_CALL _wputenv(const unsigned short *envstring); #endif #if defined(_MSC_VER) && !defined(__clang__) #ifndef _TRUNCATE #define _TRUNCATE ((size_t)-1) #endif V_CRT_LINKAGE int V_CRT_CALL _vscprintf(const char *format, va_list ap); V_CRT_LINKAGE int V_CRT_CALL _vsnprintf_s(char *buffer, size_t size, size_t count, const char *format, va_list ap); #endif #endif #ifndef _IOFBF #define _IOFBF 0 #endif #ifndef _IOLBF #define _IOLBF 1 #endif #ifndef _IONBF #define _IONBF 2 #endif #ifndef EOF #define EOF (-1) #endif #ifndef SEEK_SET #define SEEK_SET 0 #endif #ifndef SEEK_CUR #define SEEK_CUR 1 #endif #ifndef SEEK_END #define SEEK_END 2 #endif #ifndef RAND_MAX enum { #if defined(_MSC_VER) RAND_MAX = 0x7fff #else RAND_MAX = 2147483647 #endif }; #endif #undef V_CRT_LINKAGE #undef V_CRT_CALL static void v_stable_sort(void *base, size_t items, size_t item_size, qsort_callback_func cb) { if (items < 2 || item_size == 0) { return; } if (items > ((size_t)-1) / item_size) { qsort(base, items, item_size, cb); return; } const size_t bytes = items * item_size; char *base_bytes = (char*)base; char *tmp = (char*)malloc(bytes); if (tmp == 0) { qsort(base, items, item_size, cb); return; } char *src = base_bytes; char *dst = tmp; for (size_t width = 1; width < items;) { for (size_t left = 0; left < items;) { size_t mid = left; mid += width; if (mid > items) { mid = items; } size_t right = mid; right += width; if (right > items || right < mid) { right = items; } size_t i = left; size_t j = mid; size_t k = left; while (i < mid && j < right) { char *leftp = src; leftp += i * item_size; char *rightp = src; rightp += j * item_size; char *dstp = dst; dstp += k * item_size; if (cb(leftp, rightp) <= 0) { memcpy(dstp, leftp, item_size); i++; } else { memcpy(dstp, rightp, item_size); j++; } k++; } while (i < mid) { char *dstp = dst; dstp += k * item_size; char *srcp = src; srcp += i * item_size; memcpy(dstp, srcp, item_size); i++; k++; } while (j < right) { char *dstp = dst; dstp += k * item_size; char *srcp = src; srcp += j * item_size; memcpy(dstp, srcp, item_size); j++; k++; } left = right; } char *next_src = dst; dst = src; src = next_src; if (width > items / 2) { width = items; } else { width *= 2; } } if (src != base_bytes) { memcpy(base_bytes, src, bytes); } free(tmp); } #if defined(__TINYC__) // https://lists.nongnu.org/archive/html/tinycc-devel/2025-10/msg00007.html // gnu headers use to #define __attribute__ to empty for non-gcc compilers #undef __attribute__ #endif #if defined(_MSC_VER) && !defined(__clang__) // Ensure C99-like return semantics and NUL-termination for MSVC snprintf/vsnprintf. static int v__vsnprintf(char *s, size_t n, const char *fmt, va_list ap) { va_list ap_copy; va_copy(ap_copy, ap); const int needed = _vscprintf(fmt, ap_copy); va_end(ap_copy); if (n > 0) { const int written = _vsnprintf_s(s, n, _TRUNCATE, fmt, ap); if (written < 0) { s[n - 1] = 0; } } return needed; } static int v__snprintf(char *s, size_t n, const char *fmt, ...) { va_list ap; va_start(ap, fmt); const int needed = v__vsnprintf(s, n, fmt, ap); va_end(ap); return needed; } #define vsnprintf v__vsnprintf #define snprintf v__snprintf #endif //================================== GLOBALS =================================*/ #ifdef _VOBJECTFILE static void _vinit(int ___argc, voidptr ___argv); static void _vcleanup(void); #else void _vinit(int ___argc, voidptr ___argv); void _vcleanup(void); #endif #ifdef _WIN32 // Export helpers so the autogenerated DllMain, or a user-defined one, // can reuse the default V shared-library init/cleanup path. #ifdef _VOBJECTFILE static void _vinit_caller(); static void _vcleanup_caller(); #else VV_EXP void _vinit_caller(); VV_EXP void _vcleanup_caller(); #endif #endif #if !defined(_WIN32) #define sigaction_size sizeof(sigaction); #endif #define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) ) #if INTPTR_MAX == INT32_MAX #define TARGET_IS_32BIT 1 #elif INTPTR_MAX == INT64_MAX #define TARGET_IS_64BIT 1 #else #error "The environment is not 32 or 64-bit." #endif #if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__) #define TARGET_ORDER_IS_BIG 1 #elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_ARM64) || defined(_M_X64) || defined(_M_IX86) #define TARGET_ORDER_IS_LITTLE 1 #else #error "Unknown architecture endianness" #endif #if !defined(_WIN32) && !defined(__vinix__) #include #include // tolower #include #include // sleep extern char **environ; #include #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP // musl does not have that #define pthread_rwlockattr_setkind_np(a, b) #endif #endif #if (defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__serenity__) || defined(__sun) || defined(__plan9__) || defined(__OpenBSD__)) && !defined(__vinix__) #include #include // for os__wait #endif #ifdef __OpenBSD__ #include #endif #ifdef __FreeBSD__ #include #include #endif #ifdef __NetBSD__ #include // for os__wait #endif #ifdef __TERMUX__ #if !defined(__BIONIC_AVAILABILITY_GUARD) #define __BIONIC_AVAILABILITY_GUARD(api_level) 0 #endif #if __BIONIC_AVAILABILITY_GUARD(28) #else void * aligned_alloc(size_t alignment, size_t size) { return malloc(size); } #endif #endif #ifdef __APPLE__ // macOS only exports aligned_alloc starting with 10.15. #if !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500 static void *v__aligned_alloc_fallback(size_t alignment, size_t size) { void *res = 0; if (alignment < sizeof(void *)) { alignment = sizeof(void *); } if (posix_memalign(&res, alignment, size) != 0) { return 0; } return res; } #define aligned_alloc v__aligned_alloc_fallback #endif #endif #ifdef _WIN32 #ifdef WINVER #undef WINVER #endif #define WINVER 0x0600 #ifdef _WIN32_WINNT #undef _WIN32_WINNT #endif #define _WIN32_WINNT 0x0600 #ifndef WIN32_FULL #define WIN32_LEAN_AND_MEAN #endif #ifndef _UNICODE #define _UNICODE #endif #ifndef UNICODE #define UNICODE #endif #include #include // _waccess #include // _wgetcwd #ifdef V_USE_SIGNAL_H #include // signal and SIGSEGV for segmentation fault handler #endif #ifdef _MSC_VER // On MSVC these are the same (as long as /volatile:ms is passed) #define _Atomic volatile // MSVC cannot parse some things properly #undef __NOINLINE #undef __IRQHANDLER #define __NOINLINE __declspec(noinline) #define __IRQHANDLER __declspec(naked) #include #pragma comment(lib, "Dbghelp") #endif #endif #if defined(__CYGWIN__) && !defined(_WIN32) #error Cygwin is not supported, please use MinGW or Visual Studio. #endif #if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__)) || defined(_MSC_VER) #undef PRId64 #undef PRIi64 #undef PRIo64 #undef PRIu64 #undef PRIx64 #undef PRIX64 #define PRId64 "lld" #define PRIi64 "lli" #define PRIo64 "llo" #define PRIu64 "llu" #define PRIx64 "llx" #define PRIX64 "llX" #endif #ifdef _VFREESTANDING #undef _VFREESTANDING #endif // deterministic float -> u64 conversions for explicit V casts // direct C casts are undefined for out-of-range values static inline uint64_t _v_f64_to_u64(double x) { if (!(x >= 0.0)) { return 0; } if (x >= 18446744073709551616.0) { return UINT64_MAX; } return (uint64_t)x; } // unsigned/signed comparisons static inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; } static inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; } static inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; } static inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; } static inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; } static inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; } static inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; } static inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; } static inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; } static inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; } static inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; } static inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; } #if !defined(VNORETURN) #if defined(__TINYC__) #define VNORETURN __attribute__((noreturn)) # elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L # define VNORETURN _Noreturn # elif !defined(VNORETURN) && defined(__GNUC__) && __GNUC__ >= 2 # define VNORETURN __attribute__((noreturn)) # endif #ifndef VNORETURN #define VNORETURN #endif #endif #if !defined(VUNREACHABLE) #if defined(__GNUC__) && !defined(__clang__) #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__) #if (V_GCC_VERSION >= 40500L) && !defined(__TINYC__) #define VUNREACHABLE() do { __builtin_unreachable(); } while (0) #endif #endif #if defined(__clang__) && defined(__has_builtin) && !defined(__TINYC__) #if __has_builtin(__builtin_unreachable) #define VUNREACHABLE() do { __builtin_unreachable(); } while (0) #endif #endif #ifndef VUNREACHABLE #define VUNREACHABLE() do { } while (0) #endif #endif #ifndef wyhash_final_version_4_2 #define wyhash_final_version_4_2 #ifndef WYHASH_CONDOM // protections that produce different results: // 1: normal valid behavior // 2: extra protection against entropy loss (probability=2^-63), aka. "blind multiplication" #define WYHASH_CONDOM 1 #endif #ifndef WYHASH_32BIT_MUM // 0: normal version, slow on 32 bit systems // 1: faster on 32 bit systems but produces different results, incompatible with wy2u0k function #define WYHASH_32BIT_MUM 0 #endif // includes #include #if defined(_MSC_VER) && defined(_M_X64) #include #pragma intrinsic(_umul128) #endif // 128bit multiply function static inline uint64_t _wyrot(uint64_t x) { return (x>>32)|(x<<32); } static inline void _wymum(uint64_t *A, uint64_t *B){ #if(WYHASH_32BIT_MUM) uint64_t hh=(*A>>32)*(*B>>32), hl=(*A>>32)*(uint32_t)*B, lh=(uint32_t)*A*(*B>>32), ll=(uint64_t)(uint32_t)*A*(uint32_t)*B; #if(WYHASH_CONDOM>1) *A^=_wyrot(hl)^hh; *B^=_wyrot(lh)^ll; #else *A=_wyrot(hl)^hh; *B=_wyrot(lh)^ll; #endif #elif defined(__SIZEOF_INT128__) && !defined(VWASM) __uint128_t r=*A; r*=*B; #if(WYHASH_CONDOM>1) *A^=(uint64_t)r; *B^=(uint64_t)(r>>64); #else *A=(uint64_t)r; *B=(uint64_t)(r>>64); #endif #elif defined(_MSC_VER) && defined(_M_X64) #if(WYHASH_CONDOM>1) uint64_t a, b; a=_umul128(*A,*B,&b); *A^=a; *B^=b; #else *A=_umul128(*A,*B,B); #endif #else uint64_t ha=*A>>32, hb=*B>>32, la=(uint32_t)*A, lb=(uint32_t)*B, hi, lo; uint64_t rh=ha*hb, rm0=ha*lb, rm1=hb*la, rl=la*lb, t=rl+(rm0<<32), c=t>32)+(rm1>>32)+c; #if(WYHASH_CONDOM>1) *A^=lo; *B^=hi; #else *A=lo; *B=hi; #endif #endif } // multiply and xor mix function, aka MUM static inline uint64_t _wymix(uint64_t A, uint64_t B){ _wymum(&A,&B); return A^B; } // endian macros #ifndef WYHASH_LITTLE_ENDIAN #ifdef TARGET_ORDER_IS_LITTLE #define WYHASH_LITTLE_ENDIAN 1 #else #define WYHASH_LITTLE_ENDIAN 0 #endif #endif // read functions #if (WYHASH_LITTLE_ENDIAN) static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return v;} static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return v;} #elif !defined(__TINYC__) && (defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)) static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return __builtin_bswap64(v);} static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return __builtin_bswap32(v);} #elif defined(_MSC_VER) static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return _byteswap_uint64(v);} static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return _byteswap_ulong(v);} #else static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return (((v >> 56) & 0xff)| ((v >> 40) & 0xff00)| ((v >> 24) & 0xff0000)| ((v >> 8) & 0xff000000)| ((v << 8) & 0xff00000000)| ((v << 24) & 0xff0000000000)| ((v << 40) & 0xff000000000000)| ((v << 56) & 0xff00000000000000)); } static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return (((v >> 24) & 0xff)| ((v >> 8) & 0xff00)| ((v << 8) & 0xff0000)| ((v << 24) & 0xff000000)); } #endif static inline uint64_t _wyr3(const uint8_t *p, size_t k) { return (((uint64_t)p[0])<<16)|(((uint64_t)p[k>>1])<<8)|p[k-1];} // wyhash main function static inline uint64_t wyhash(const void *key, size_t len, uint64_t seed, const uint64_t *secret){ const uint8_t *p=(const uint8_t *)key; seed^=_wymix(seed^secret[0]^len,secret[1]); uint64_t a, b; if (_likely_(len<=16)) { if (_likely_(len>=4)) { a=(_wyr4(p)<<32)|_wyr4(p+((len>>3)<<2)); b=(_wyr4(p+len-4)<<32)|_wyr4(p+len-4-((len>>3)<<2)); } else if (_likely_(len>0)) { a=_wyr3(p,len); b=0; } else a=b=0; } else { size_t i=len; if (_unlikely_(i>=48)) { uint64_t see1=seed, see2=seed; do { seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed); see1=_wymix(_wyr8(p+16)^secret[2],_wyr8(p+24)^see1); see2=_wymix(_wyr8(p+32)^secret[3],_wyr8(p+40)^see2); p+=48; i-=48; } while(_likely_(i>=48)); seed^=see1^see2; } while(_unlikely_(i>16)) { seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed); i-=16; p+=16; } a=_wyr8(p+i-16); b=_wyr8(p+i-8); } a^=secret[1]; b^=seed; _wymum(&a,&b); return _wymix(a^secret[0]^len,b^secret[1]); } // the default secret parameters static const uint64_t _wyp[4] = {0x2d358dccaa6c78a5ull, 0x8bb84b93962eacc9ull, 0x4b33a62ed433d4a3ull, 0x4d5a2da51de1aa47ull}; // a useful 64bit-64bit mix function to produce deterministic pseudo random numbers that can pass BigCrush and PractRand static inline uint64_t wyhash64(uint64_t A, uint64_t B){ A^=0x2d358dccaa6c78a5ull; B^=0x8bb84b93962eacc9ull; _wymum(&A,&B); return _wymix(A^0x2d358dccaa6c78a5ull,B^0x8bb84b93962eacc9ull);} // the wyrand PRNG that pass BigCrush and PractRand static inline uint64_t wyrand(uint64_t *seed){ *seed+=0x2d358dccaa6c78a5ull; return _wymix(*seed,*seed^0x8bb84b93962eacc9ull);} #ifndef __vinix__ // convert any 64 bit pseudo random numbers to uniform distribution [0,1). It can be combined with wyrand, wyhash64 or wyhash. static inline double wy2u01(uint64_t r){ const double _wynorm=1.0/(1ull<<52); return (r>>12)*_wynorm;} // convert any 64 bit pseudo random numbers to APPROXIMATE Gaussian distribution. It can be combined with wyrand, wyhash64 or wyhash. static inline double wy2gau(uint64_t r){ const double _wynorm=1.0/(1ull<<20); return ((r&0x1fffff)+((r>>21)&0x1fffff)+((r>>42)&0x1fffff))*_wynorm-3.0;} #endif #if(!WYHASH_32BIT_MUM) // fast range integer random number generation on [0,k) credit to Daniel Lemire. May not work when WYHASH_32BIT_MUM=1. It can be combined with wyrand, wyhash64 or wyhash. static inline uint64_t wy2u0k(uint64_t r, uint64_t k){ _wymum(&r,&k); return k; } #endif #endif #define _IN_MAP(val, m) builtin__map_exists(m, val) #if __GLIBC__ == 2 && __GLIBC_MINOR__ < 30 #include #define gettid() syscall(SYS_gettid) #endif // V includes: #if defined(__TINYC__) && defined(__has_include) // tcc does not support has_include properly yet, turn it off completely #undef __has_include #endif #if defined(__TINYC__) && defined(__BIONIC__) #define __builtin_nanf(ignored_string) (0.0F / 0.0F) #define __builtin_nan(ignored_string) (0.0 / 0.0) #define __builtin_nanl(ignored_string) (0.0L / 0.0L) #define __builtin_inff() (1.0F / 0.0F) #define __builtin_inf() (1.0 / 0.0) #define __builtin_infl() (1.0L / 0.0L) #define __builtin_huge_valf() (1.0F / 0.0F) #define __builtin_huge_val() (1.0 / 0.0) #define __builtin_huge_vall() (1.0L / 0.0L) #endif #if 1 // added by module `builtin.closure`, file: closure_nix.c.v:4: #ifdef __TINYC__ #include #else #if defined(__has_include) #if __has_include() #include #else #error VERROR_MESSAGE Header file , needed for module `builtin.closure` was not found. Please install the corresponding development headers. #endif #else #include #endif #endif // inserted by module `builtin.closure`, file: closure_nix.c.v:5: #ifndef V_CLOSURE_ONCE_NIX_H #define V_CLOSURE_ONCE_NIX_H #include typedef void (*v_closure_init_fn)(void); #ifndef V_CLOSURE_STATIC_INLINE # ifdef _MSC_VER # define V_CLOSURE_STATIC_INLINE static __inline # else # define V_CLOSURE_STATIC_INLINE static inline # endif #endif static pthread_mutex_t v_closure_once_mutex = PTHREAD_MUTEX_INITIALIZER; static int v_closure_once_done = 0; V_CLOSURE_STATIC_INLINE void v_closure_init_once(v_closure_init_fn init_fn) { pthread_mutex_lock(&v_closure_once_mutex); if (!v_closure_once_done) { init_fn(); v_closure_once_done = 1; } pthread_mutex_unlock(&v_closure_once_mutex); } #endif #endif #if 1 // added by module `builtin.closure`, file: closure_nix.c.v:4: #ifdef __TINYC__ #include #else #if defined(__has_include) #if __has_include() #include #else #error VERROR_MESSAGE Header file , needed for module `builtin.closure` was not found. Please install the corresponding development headers. #endif #else #include #endif #endif // inserted by module `builtin.closure`, file: closure_nix.c.v:5: #ifndef V_CLOSURE_ONCE_NIX_H #define V_CLOSURE_ONCE_NIX_H #include typedef void (*v_closure_init_fn)(void); #ifndef V_CLOSURE_STATIC_INLINE # ifdef _MSC_VER # define V_CLOSURE_STATIC_INLINE static __inline # else # define V_CLOSURE_STATIC_INLINE static inline # endif #endif static pthread_mutex_t v_closure_once_mutex = PTHREAD_MUTEX_INITIALIZER; static int v_closure_once_done = 0; V_CLOSURE_STATIC_INLINE void v_closure_init_once(v_closure_init_fn init_fn) { pthread_mutex_lock(&v_closure_once_mutex); if (!v_closure_once_done) { init_fn(); v_closure_once_done = 1; } pthread_mutex_unlock(&v_closure_once_mutex); } #endif #endif // inserted by module `builtin`, file: allocation.c.v:43: #ifndef V_TRACK_HEAP_CHECKS_H #define V_TRACK_HEAP_CHECKS_H #if defined(CUSTOM_DEFINE_track_heap) && (defined(_VGCBOEHM) || defined(CUSTOM_DEFINE_gcboehm)) #error "-d track_heap requires manual memory management; rebuild with -gc none" #endif #if defined(CUSTOM_DEFINE_track_heap) && defined(CUSTOM_DEFINE_vgc) #error "-d track_heap requires manual memory management; rebuild with -gc none" #endif #if defined(CUSTOM_DEFINE_track_heap) && defined(_VPREALLOC) #error "-d track_heap requires manual memory management; rebuild with -gc none (not -prealloc)" #endif #endif // added by module `builtin`, file: float.c.v:9: #ifdef __TINYC__ #include #else #if defined(__has_include) #if __has_include() #include #else #error VERROR_MESSAGE Header file , needed for module `builtin` was not found. Please install the corresponding development headers. #endif #else #include #endif #endif // added by module `math`, file: math.c.v:6: #ifdef __TINYC__ #include #else #if defined(__has_include) #if __has_include() #include #else #error VERROR_MESSAGE Header file , needed for module `math` was not found. Please install the corresponding development headers. #endif #else #include #endif #endif #if !defined(__cplusplus) && !defined(CUSTOM_DEFINE_no_bool) #ifdef bool #undef bool #endif #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L #ifdef CUSTOM_DEFINE_4bytebool typedef int bool; #else typedef u8 bool; #endif #endif #endif // V global/const #define ... : #define _const_builtin__closure__assumed_page_size 16384 #define _const_strconv__digits 18 #define _const_strconv__c_dpoint '.' #define _const_strconv__c_plus '+' #define _const_strconv__c_minus '-' #define _const_strconv__c_zero '0' #define _const_strconv__c_nine '9' #define _const_strconv__int_size 32 #define _const_strconv__max_size_f64_char 512 #define _const_autostr_type_stack_max_depth 64 #define _const_min_int -2147483648 #define _const_max_int 2147483647 #define _const_hashbits 24 #define _const_max_cached_hashbits 16 #define _const_init_log_capicity 5 #define _const_init_capicity 32 #define _const_init_even_index 30 #define _const_extra_metas_inc 4 #define _const_rune_maps_columns_in_row 4 #define _const_rune_maps_ul -3 #define _const_rune_maps_utl -2 #define _const_degree 6 #define _const_mid_index 5 #define _const_replace_stack_buffer_size 10 #define _const_kmp_stack_buffer_size 20 #define _const_math__internal__max_int_fact_arg 170 #define _const_math__shift 52 #define _const_math__bias 1023 #define _const_math__pi_2 1.5707963267948966 #define _const_math__pi_4 0.7853981633974483 #define _const_math__one_over_tau 0.15915494309189535 #define _const_math__one_over_pi 0.3183098861837907 #define _const_math__tau_over2 3.141592653589793 #define _const_math__tau_over4 1.5707963267948966 #define _const_math__tau_over8 0.7853981633974483 #define _const_math__log2_e 1.4426950408889634 #define _const_math__log10_e 0.43429448190325176 // Enum definitions: typedef enum { strings__IndentState__normal, // strings__IndentState__in_string, // +1 } strings__IndentState; typedef enum { builtin__closure__MemoryProtectAtrr__read_exec, // builtin__closure__MemoryProtectAtrr__read_write, // +1 } builtin__closure__MemoryProtectAtrr; typedef enum { strconv__ParserState__ok, // strconv__ParserState__pzero, // +1 strconv__ParserState__mzero, // +2 strconv__ParserState__pinf, // +3 strconv__ParserState__minf, // +4 strconv__ParserState__invalid_number, // +5 strconv__ParserState__extra_char, // +6 } strconv__ParserState; typedef enum { strconv__Align_text__right = 0, // 0 strconv__Align_text__left, // 0+1 strconv__Align_text__center, // 0+2 } strconv__Align_text; typedef enum { strconv__Char_parse_state__start, // strconv__Char_parse_state__norm_char, // +1 strconv__Char_parse_state__field_char, // +2 strconv__Char_parse_state__pad_ch, // +3 strconv__Char_parse_state__len_set_start, // +4 strconv__Char_parse_state__len_set_in, // +5 strconv__Char_parse_state__check_type, // +6 strconv__Char_parse_state__check_float, // +7 strconv__Char_parse_state__check_float_in, // +8 strconv__Char_parse_state__reset_params, // +9 } strconv__Char_parse_state; typedef enum { ArrayFlags__noslices = 1U, // u64(1) << 0 ArrayFlags__noshrink = 2U, // u64(1) << 1 ArrayFlags__nogrow = 4U, // u64(1) << 2 ArrayFlags__nofree = 8U, // u64(1) << 3 ArrayFlags__managed = 16U, // u64(1) << 4 ArrayFlags__noscan_data = 32U, // u64(1) << 5 ArrayFlags__is_slice = 64U, // u64(1) << 6 } ArrayFlags; typedef enum { ChanState__success, // ChanState__not_ready, // +1 ChanState__closed, // +2 } ChanState; typedef enum { GraphemeBreakProperty__other, // GraphemeBreakProperty__cr, // +1 GraphemeBreakProperty__lf, // +2 GraphemeBreakProperty__control, // +3 GraphemeBreakProperty__extend, // +4 GraphemeBreakProperty__regional_indicator, // +5 GraphemeBreakProperty__prepend, // +6 GraphemeBreakProperty__spacing_mark, // +7 GraphemeBreakProperty__l, // +8 GraphemeBreakProperty__v, // +9 GraphemeBreakProperty__t, // +10 GraphemeBreakProperty__lv, // +11 GraphemeBreakProperty__lvt, // +12 GraphemeBreakProperty__zwj, // +13 } GraphemeBreakProperty; typedef enum { AttributeKind__plain, // AttributeKind__string, // +1 AttributeKind__number, // +2 AttributeKind__bool, // +3 AttributeKind__comptime_define, // +4 } AttributeKind; typedef enum { MapMode__to_upper, // MapMode__to_lower, // +1 MapMode__to_title, // +2 } MapMode; typedef enum { TrimMode__trim_left, // TrimMode__trim_right, // +1 TrimMode__trim_both, // +2 } TrimMode; typedef enum { StrIntpType__si_no_str = 0, // 0 StrIntpType__si_c, // 0+1 StrIntpType__si_u8, // 0+2 StrIntpType__si_i8, // 0+3 StrIntpType__si_u16, // 0+4 StrIntpType__si_i16, // 0+5 StrIntpType__si_u32, // 0+6 StrIntpType__si_i32, // 0+7 StrIntpType__si_u64, // 0+8 StrIntpType__si_i64, // 0+9 StrIntpType__si_e32, // 0+10 StrIntpType__si_e64, // 0+11 StrIntpType__si_f32, // 0+12 StrIntpType__si_f64, // 0+13 StrIntpType__si_g32, // 0+14 StrIntpType__si_g64, // 0+15 StrIntpType__si_s, // 0+16 StrIntpType__si_p, // 0+17 StrIntpType__si_r, // 0+18 StrIntpType__si_vp, // 0+19 } StrIntpType; // V type definitions: struct IError { union { void* _object; None__* _None__; voidptr* _voidptr; MessageError* _MessageError; Error* _Error; }; u32 _typ; void* _methods; }; struct string { u8* str; int len; int is_lit; }; struct array { voidptr data; int offset; int len; int cap; ArrayFlags flags; int element_size; }; struct DenseArray { int key_bytes; int value_bytes; int cap; int len; u32 deletes; u8* all_deleted; u8* keys; u8* values; }; struct map { int key_bytes; int value_bytes; u32 even_index; u8 cached_hashbits; u8 shift; DenseArray key_values; u32* metas; u32 extra_metas; bool has_string_keys; MapHashFn hash_fn; MapEqFn key_eq_fn; MapCloneFn clone_fn; MapFreeFn free_fn; int len; }; struct Error { E_STRUCT_DECL; }; struct _option { u8 state; IError err; }; struct _result { bool is_error; IError err; }; typedef array Array_string; typedef array Array_u8; typedef array Array_voidptr; typedef array Array_int; typedef array Array_IError; typedef array Array_rune; typedef string Array_fixed_string_11 [11]; typedef voidptr Array_fixed_voidptr_11 [11]; typedef array Array_RepIndex; typedef map Map_string_int; typedef array Array_bool; typedef array Array_builtin__closure__ClosureLifetimeRecord; typedef array Array_builtin__closure__ClosureLifetimeFrame; typedef map Map_voidptr_builtin__closure__ClosureLiveInfo; typedef map Map_u64_builtin__closure__ClosureLifetimeState_ptr; typedef u8 Array_fixed_u8_128 [128]; typedef array Array_f64; typedef array Array_math__BezierPoint; typedef f64 Array_fixed_f64_4 [4]; typedef u8 Array_fixed_u8_32 [32]; typedef u8 Array_fixed_u8_64 [64]; typedef u8 Array_fixed_u8_5 [5]; typedef u8 Array_fixed_u8_20 [20]; typedef u8 Array_fixed_u8_15 [15]; typedef u8 Array_fixed_u8_6 [6]; typedef u8 Array_fixed_u8_256 [256]; typedef u64 Array_fixed_u64_309 [309]; typedef u64 Array_fixed_u64_324 [324]; typedef u32 Array_fixed_u32_10 [10]; typedef u64 Array_fixed_u64_20 [20]; typedef u64 Array_fixed_u64_584 [584]; typedef u64 Array_fixed_u64_652 [652]; typedef f64 Array_fixed_f64_36 [36]; typedef u8 Array_fixed_u8_26 [26]; typedef u8 Array_fixed_u8_512 [512]; typedef u64 Array_fixed_u64_47 [47]; typedef u64 Array_fixed_u64_31 [31]; typedef int Array_fixed_int_64 [64]; typedef voidptr Array_fixed_voidptr_64 [64]; typedef array Array_GraphemeBreakProperty; typedef u8 Array_fixed_u8_17 [17]; typedef i32 Array_fixed_i32_1264 [1264]; typedef int Array_fixed_int_10 [10]; typedef int Array_fixed_int_20 [20]; typedef array Array_StrIntpType; typedef Array_u8 strings__Builder; typedef bool (*anon_fn_voidptr__bool)(voidptr); typedef voidptr (*anon_fn_voidptr__voidptr)(voidptr); typedef int (*anon_fn_voidptr_voidptr__int)(voidptr,voidptr); typedef int (*FnSortCB)(const void*,const void*); typedef void (*FnExitCb)(); typedef void (*FnGC_WarnCB)(char*,usize); typedef voidptr (*builtin__closure__ClosureGetDataFn)(); typedef void (*builtin__closure__ClosureInitFn)(); typedef void (*anon_fn_)(); // #start sorted_symbols struct none { E_STRUCT_DECL; }; struct None__ { Error Error; }; struct InputRuneIterator { E_STRUCT_DECL; }; struct GCHeapUsage { usize heap_size; usize free_bytes; usize total_bytes; usize unmapped_bytes; usize bytes_since_gc; }; struct ArrayDataHeader { bool has_slices; }; struct MessageError { string msg; int code; }; union strconv__Float64u { f64 f; u64 u; }; union strconv__Float32u { f32 f; u32 u; }; struct GraphemeState { GraphemeBreakProperty prev_prop; int ri_count; u8 extended_pictographic_state; }; struct VAssertMetaInfo { string fpath; int line_nr; string fn_name; string src; string op; string llabel; string rlabel; string lvalue; string rvalue; string message; bool has_msg; }; struct SortedMap { int value_bytes; mapnode* root; int len; }; struct RepIndex { int idx; int val_idx; }; struct WrapConfig { int width; string end; }; struct RunesIterator { string s; int i; }; union StrIntpMem { u32 d_c; u8 d_u8; i8 d_i8; u16 d_u16; i16 d_i16; u32 d_u32; i32 d_i32; u64 d_u64; i64 d_i64; f32 d_f32; f64 d_f64; string d_s; string d_r; voidptr d_p; voidptr d_vp; }; struct strconv__BF_param { u8 pad_ch; int len0; int len1; bool positive; bool sign_flag; strconv__Align_text align; bool rm_tail_zero; }; struct ToWideConfig { bool from_ansi; }; struct strings__IndentParam { rune block_start; rune block_end; rune indent_char; int indent_count; int starting_level; }; struct strconv__PrepNumber { bool negative; int exponent; u64 mantissa; }; struct strconv__AtoF64Param { bool allow_extra_chars; }; struct strconv__Dec32 { u32 m; int e; }; union strconv__Uf32 { f32 f; u32 u; }; struct strconv__Dec64 { u64 m; int e; }; struct strconv__Uint128 { u64 lo; u64 hi; }; union strconv__Uf64 { f64 f; u64 u; }; struct builtin__closure__ClosurePage { builtin__closure__ClosurePage* next; voidptr exec_page_start; }; struct builtin__closure__ClosureLiveInfo { voidptr ctx; bool owns_data; u64 generation; }; struct builtin__closure__ClosureLifetimeRecord { voidptr exec_ptr; u64 generation; }; struct builtin__closure__ClosureLifetimeFrame { int start; int end; }; struct builtin__closure__ClosureLifetimeState { u64 owner_thread; bool active; bool disposed; int suspended; int frame_start; u64 frame_gen; u64 generation; u64 frame_generation; Array_builtin__closure__ClosureLifetimeRecord records; Array_builtin__closure__ClosureLifetimeFrame frames; builtin__closure__ClosureLifetimeState* next_free; }; struct builtin__closure__Lifetime { builtin__closure__ClosureLifetimeState* state; u64 generation; bool disposed; }; struct builtin__closure__FrameToken { builtin__closure__ClosureLifetimeState* state; u64 thread_id; u64 state_generation; u64 generation; }; struct math__BezierPoint { f64 x; f64 y; }; struct math__DigitParams { int base; bool reverse; }; struct math__ChebSeries { Array_f64 c; int order; f64 a; f64 b; }; union math__U32_F32 { u32 u; f32 f; }; union math__U64_F64 { u64 u; f64 f; }; struct mapnode { voidptr* children; int len; Array_fixed_string_11 keys; Array_fixed_voidptr_11 values; }; struct StrIntpData { string str; u32 fmt; StrIntpMem d; int dyn_width; int dyn_precision; u8 dyn_flags; }; struct builtin__closure__ClosureMutex { Array_fixed_u8_128 closure_mtx; }; struct builtin__closure__Closure { builtin__closure__ClosureMutex ClosureMutex; voidptr closure_ptr; builtin__closure__ClosureGetDataFn closure_get_data; int closure_cap; voidptr free_closure_ptr; builtin__closure__ClosurePage* pages; int v_page_size; Map_voidptr_builtin__closure__ClosureLiveInfo live; Map_u64_builtin__closure__ClosureLifetimeState_ptr active_lifetimes; u64 next_generation; builtin__closure__ClosureLifetimeState* free_lifetime_states; u64 next_lifetime_generation; u64 lifetime_state_allocs; }; // #end sorted_symbols // BEGIN_array_fixed_return_structs struct _v_Array_fixed_string_11 { string ret_arr[11]; }; struct _v_Array_fixed_voidptr_11 { voidptr ret_arr[11]; }; struct _v_Array_fixed_u8_128 { u8 ret_arr[128]; }; struct _v_Array_fixed_f64_4 { f64 ret_arr[4]; }; struct _v_Array_fixed_u8_32 { u8 ret_arr[32]; }; struct _v_Array_fixed_u8_64 { u8 ret_arr[64]; }; struct _v_Array_fixed_u8_5 { u8 ret_arr[5]; }; struct _v_Array_fixed_u8_20 { u8 ret_arr[20]; }; struct _v_Array_fixed_u8_15 { u8 ret_arr[15]; }; struct _v_Array_fixed_u8_6 { u8 ret_arr[6]; }; struct _v_Array_fixed_u8_256 { u8 ret_arr[256]; }; struct _v_Array_fixed_u64_309 { u64 ret_arr[309]; }; struct _v_Array_fixed_u64_324 { u64 ret_arr[324]; }; struct _v_Array_fixed_u32_10 { u32 ret_arr[10]; }; struct _v_Array_fixed_u64_20 { u64 ret_arr[20]; }; struct _v_Array_fixed_u64_584 { u64 ret_arr[584]; }; struct _v_Array_fixed_u64_652 { u64 ret_arr[652]; }; struct _v_Array_fixed_f64_36 { f64 ret_arr[36]; }; struct _v_Array_fixed_u8_26 { u8 ret_arr[26]; }; struct _v_Array_fixed_u8_512 { u8 ret_arr[512]; }; struct _v_Array_fixed_u64_47 { u64 ret_arr[47]; }; struct _v_Array_fixed_u64_31 { u64 ret_arr[31]; }; struct _v_Array_fixed_int_64 { int ret_arr[64]; }; struct _v_Array_fixed_voidptr_64 { voidptr ret_arr[64]; }; struct _v_Array_fixed_u8_17 { u8 ret_arr[17]; }; struct _v_Array_fixed_i32_1264 { i32 ret_arr[1264]; }; struct _v_Array_fixed_int_10 { int ret_arr[10]; }; struct _v_Array_fixed_int_20 { int ret_arr[20]; }; // END_array_fixed_return_structs // BEGIN_multi_return_structs struct multi_return_u32_u32 { u32 arg0; u32 arg1; }; struct multi_return_string_string { string arg0; string arg1; }; struct multi_return_int_int { int arg0; int arg1; }; struct multi_return_rune_int { rune arg0; int arg1; }; struct multi_return_u32_u32_u32 { u32 arg0; u32 arg1; u32 arg2; }; struct multi_return_strconv__ParserState_strconv__PrepNumber { strconv__ParserState arg0; strconv__PrepNumber arg1; }; struct multi_return_u64_int { u64 arg0; int arg1; }; struct multi_return_i64_int { i64 arg0; int arg1; }; struct multi_return_strconv__Dec32_bool { strconv__Dec32 arg0; bool arg1; }; struct multi_return_strconv__Dec64_bool { strconv__Dec64 arg0; bool arg1; }; struct multi_return_f64_int { f64 arg0; int arg1; }; struct multi_return_i64_i64_i64 { i64 arg0; i64 arg1; i64 arg2; }; struct multi_return_f64_f64 { f64 arg0; f64 arg1; }; struct multi_return_u64_u64 { u64 arg0; u64 arg1; }; // END_multi_return_structs static bool Array_u8_contains(Array_u8 a, u8 v); // V Option_xxx definitions: struct _option_builtin__closure__ClosureLiveInfo { byte state; IError err; byte data[sizeof(builtin__closure__ClosureLiveInfo) > 1 ? sizeof(builtin__closure__ClosureLiveInfo) : 1]; }; struct _option_builtin__closure__ClosureLifetimeState_ptr { byte state; IError err; byte data[sizeof(builtin__closure__ClosureLifetimeState*) > 1 ? sizeof(builtin__closure__ClosureLifetimeState*) : 1]; }; struct _option_rune { byte state; IError err; byte data[sizeof(rune) > 1 ? sizeof(rune) : 1]; }; struct _option_multi_return_string_string { byte state; IError err; byte data[sizeof(multi_return_string_string) > 1 ? sizeof(multi_return_string_string) : 1]; }; struct _option_int { byte state; IError err; byte data[sizeof(int) > 1 ? sizeof(int) : 1]; }; struct _option_u8 { byte state; IError err; byte data[sizeof(u8) > 1 ? sizeof(u8) : 1]; }; // V result_xxx definitions: struct _result_int { bool is_error; IError err; byte data[sizeof(int) > 1 ? sizeof(int) : 1]; }; struct _result_builtin__closure__ClosureLifetimeState_ptr { bool is_error; IError err; byte data[sizeof(builtin__closure__ClosureLifetimeState*) > 1 ? sizeof(builtin__closure__ClosureLifetimeState*) : 1]; }; struct _result_builtin__closure__FrameToken { bool is_error; IError err; byte data[sizeof(builtin__closure__FrameToken) > 1 ? sizeof(builtin__closure__FrameToken) : 1]; }; struct _result_void { bool is_error; IError err; byte data[sizeof(u8) > 1 ? sizeof(u8) : 1]; }; struct _result_f64 { bool is_error; IError err; byte data[sizeof(f64) > 1 ? sizeof(f64) : 1]; }; struct _result_u64 { bool is_error; IError err; byte data[sizeof(u64) > 1 ? sizeof(u64) : 1]; }; struct _result_i64 { bool is_error; IError err; byte data[sizeof(i64) > 1 ? sizeof(i64) : 1]; }; struct _result_multi_return_i64_int { bool is_error; IError err; byte data[sizeof(multi_return_i64_int) > 1 ? sizeof(multi_return_i64_int) : 1]; }; struct _result_i8 { bool is_error; IError err; byte data[sizeof(i8) > 1 ? sizeof(i8) : 1]; }; struct _result_i16 { bool is_error; IError err; byte data[sizeof(i16) > 1 ? sizeof(i16) : 1]; }; struct _result_i32 { bool is_error; IError err; byte data[sizeof(i32) > 1 ? sizeof(i32) : 1]; }; struct _result_u8 { bool is_error; IError err; byte data[sizeof(u8) > 1 ? sizeof(u8) : 1]; }; struct _result_u16 { bool is_error; IError err; byte data[sizeof(u16) > 1 ? sizeof(u16) : 1]; }; struct _result_u32 { bool is_error; IError err; byte data[sizeof(u32) > 1 ? sizeof(u32) : 1]; }; struct _result_rune { bool is_error; IError err; byte data[sizeof(rune) > 1 ? sizeof(rune) : 1]; }; struct _result_string { bool is_error; IError err; byte data[sizeof(string) > 1 ? sizeof(string) : 1]; }; // V definitions: static char * v_typeof_interface_IError(u32 sidx); u32 v_typeof_interface_idx_IError(u32 sidx); // end of definitions #endif strings__Builder strings__new_builder(int initial_size); Array_u8 strings__Builder_reuse_as_plain_u8_array(strings__Builder* b); void strings__Builder_write_ptr(strings__Builder* b, u8* ptr, int len); void strings__Builder_write_rune(strings__Builder* b, rune r); void strings__Builder_write_runes(strings__Builder* b, Array_rune runes); void strings__Builder_write_u8(strings__Builder* b, u8 data); void strings__Builder_write_byte(strings__Builder* b, u8 data); void strings__Builder_write_decimal(strings__Builder* b, i64 n); void strings__Builder_write_u_decimal(strings__Builder* b, u64 n); _result_int strings__Builder_write(strings__Builder* b, Array_u8 data); void strings__Builder_drain_builder(strings__Builder* b, strings__Builder* other, int other_new_cap); u8 strings__Builder_byte_at(strings__Builder* b, int n); void strings__Builder_write_string(strings__Builder* b, string s); void strings__Builder_write_string2(strings__Builder* b, string s1, string s2); void strings__Builder_go_back(strings__Builder* b, int n); string strings__Builder_spart(strings__Builder* b, int start_pos, int n); string strings__Builder_cut_last(strings__Builder* b, int n); string strings__Builder_cut_to(strings__Builder* b, int pos); void strings__Builder_go_back_to(strings__Builder* b, int pos); void strings__Builder_writeln(strings__Builder* b, string s); void strings__Builder_writeln2(strings__Builder* b, string s1, string s2); string strings__Builder_last_n(strings__Builder* b, int n); string strings__Builder_after(strings__Builder* b, int n); string strings__Builder_str(strings__Builder* b); void strings__Builder_ensure_cap(strings__Builder* b, int n); void strings__Builder_grow_len(strings__Builder* b, int n); void strings__Builder_free(strings__Builder* b); void strings__Builder_write_repeated_rune(strings__Builder* b, rune r, int count); void strings__Builder_indent(strings__Builder* b, string s, strings__IndentParam param); VV_LOC int strings__min(int a, int b, int c); VV_LOC int strings__max2(int a, int b); VV_LOC int strings__min2(int a, int b); VV_LOC int strings__abs2(int a, int b); int strings__levenshtein_distance(string a, string b); f32 strings__levenshtein_distance_percentage(string a, string b); f32 strings__dice_coefficient(string s1, string s2); int strings__hamming_distance(string a, string b); f32 strings__hamming_similarity(string a, string b); f64 strings__jaro_similarity(string a, string b); f64 strings__jaro_winkler_similarity(string a, string b); string strings__repeat(u8 c, int n); string strings__repeat_string(string s, int n); string strings__find_between_pair_u8(string input, u8 start, u8 end); string strings__find_between_pair_rune(string input, rune start, rune end); string strings__find_between_pair_string(string input, string start, string end); Array_string strings__split_capital(string s); VV_LOC bool builtin__closure__is_ppc64(void); VV_LOC voidptr* builtin__closure__closure_slot_meta(voidptr exec_ptr); VV_LOC void builtin__closure__closure_register_page(voidptr exec_page_start); VV_LOC bool builtin__closure__closure_is_managed(voidptr exec_ptr); VV_LOC builtin__closure__ClosureLiveInfo builtin__closure__closure_live_delete(voidptr exec_ptr); VV_LOC builtin__closure__ClosureLifetimeState* builtin__closure__new_closure_lifetime_state_no_lock(void); VV_LOC builtin__closure__ClosureLifetimeState* builtin__closure__new_closure_lifetime_state(void); VV_LOC void builtin__closure__closure_lifetime_recycle_state_no_lock(builtin__closure__ClosureLifetimeState** state); VV_LOC string builtin__closure__closure_lifetime_error(builtin__closure__ClosureLifetimeState* state, u64 generation, u64 thread_id); VV_LOC _result_builtin__closure__ClosureLifetimeState_ptr builtin__closure__Lifetime_ensure_state(builtin__closure__Lifetime* lifetime); VV_LOC voidptr builtin__closure__closure_slot_data(voidptr exec_ptr); VV_LOC bool builtin__closure__closure_release_no_lock(voidptr exec_ptr, u64 generation); VV_LOC void builtin__closure__closure_lifetime_release_records_no_lock(Array_builtin__closure__ClosureLifetimeRecord records, int start, int end); VV_LOC void builtin__closure__closure_lifetime_reclaim_no_lock(builtin__closure__ClosureLifetimeState* state, int retain); VV_LOC void builtin__closure__closure_ensure_initialized(void); builtin__closure__Lifetime builtin__closure__new_lifetime(void); VV_LOC _result_builtin__closure__FrameToken builtin__closure__Lifetime_begin_frame(builtin__closure__Lifetime* lifetime); VV_LOC _result_void builtin__closure__Lifetime_end_frame(builtin__closure__Lifetime* lifetime, builtin__closure__FrameToken token); _result_void builtin__closure__Lifetime_frame(builtin__closure__Lifetime* lifetime, void (*work)()); _result_void builtin__closure__Lifetime_reclaim(builtin__closure__Lifetime* lifetime, int retain); _result_void builtin__closure__Lifetime_reclaim_all(builtin__closure__Lifetime* lifetime); _result_void builtin__closure__Lifetime_dispose(builtin__closure__Lifetime* lifetime); _result_void builtin__closure__Lifetime_suspend(builtin__closure__Lifetime* lifetime, void (*work)()); _result_void builtin__closure__Lifetime_untracked(builtin__closure__Lifetime* lifetime, void (*work)()); VV_LOC void builtin__closure__closure_alloc(void); VV_LOC void builtin__closure__closure_init_body(void); VV_LOC voidptr builtin__closure__closure_mtx_ptr_platform(void); VV_LOC u8* builtin__closure__closure_alloc_platform(void); VV_LOC void builtin__closure__closure_memory_protect_platform(voidptr ptr, isize size, builtin__closure__MemoryProtectAtrr attr); VV_LOC int builtin__closure__get_page_size_platform(void); VV_LOC void builtin__closure__closure_mtx_lock_init_platform(void); VV_LOC void builtin__closure__closure_mtx_lock_platform(void); VV_LOC void builtin__closure__closure_mtx_unlock_platform(void); VV_LOC u64 builtin__closure__closure_current_thread_id_platform(void); VV_LOC void builtin__closure__closure_init_once_platform(void); multi_return_u64_u64 math__bits__mul_64(u64 x, u64 y); multi_return_u64_u64 math__bits__mul_add_64(u64 x, u64 y, u64 z); multi_return_u64_u64 math__bits__div_64(u64 hi, u64 lo, u64 y1); int math__bits__leading_zeros_8(u8 x); int math__bits__leading_zeros_16(u16 x); int math__bits__leading_zeros_32(u32 x); int math__bits__leading_zeros_64(u64 x); int math__bits__trailing_zeros_8(u8 x); int math__bits__trailing_zeros_16(u16 x); int math__bits__trailing_zeros_32(u32 x); int math__bits__trailing_zeros_64(u64 x); int math__bits__ones_count_8(u8 x); int math__bits__ones_count_16(u16 x); int math__bits__ones_count_32(u32 x); int math__bits__ones_count_64(u64 x); int math__bits__pure_v_but_overridden_by_c_leading_zeros_8(u8 x); VV_LOC int math__bits__leading_zeros_8_default(u8 x); int math__bits__pure_v_but_overridden_by_c_leading_zeros_16(u16 x); VV_LOC int math__bits__leading_zeros_16_default(u16 x); int math__bits__pure_v_but_overridden_by_c_leading_zeros_32(u32 x); VV_LOC int math__bits__leading_zeros_32_default(u32 x); int math__bits__pure_v_but_overridden_by_c_leading_zeros_64(u64 x); VV_LOC int math__bits__leading_zeros_64_default(u64 x); int math__bits__pure_v_but_overridden_by_c_trailing_zeros_8(u8 x); VV_LOC int math__bits__trailing_zeros_8_default(u8 x); int math__bits__pure_v_but_overridden_by_c_trailing_zeros_16(u16 x); VV_LOC int math__bits__trailing_zeros_16_default(u16 x); int math__bits__pure_v_but_overridden_by_c_trailing_zeros_32(u32 x); VV_LOC int math__bits__trailing_zeros_32_default(u32 x); int math__bits__pure_v_but_overridden_by_c_trailing_zeros_64(u64 x); VV_LOC int math__bits__trailing_zeros_64_default(u64 x); int math__bits__pure_v_but_overridden_by_c_ones_count_8(u8 x); VV_LOC int math__bits__ones_count_8_default(u8 x); int math__bits__pure_v_but_overridden_by_c_ones_count_16(u16 x); VV_LOC int math__bits__ones_count_16_default(u16 x); int math__bits__pure_v_but_overridden_by_c_ones_count_32(u32 x); VV_LOC int math__bits__ones_count_32_default(u32 x); int math__bits__pure_v_but_overridden_by_c_ones_count_64(u64 x); VV_LOC int math__bits__ones_count_64_default(u64 x); u8 math__bits__rotate_left_8(u8 x, int k); u16 math__bits__rotate_left_16(u16 x, int k); u32 math__bits__rotate_left_32(u32 x, int k); u64 math__bits__rotate_left_64(u64 x, int k); u8 math__bits__reverse_8(u8 x); u16 math__bits__reverse_16(u16 x); u32 math__bits__reverse_32(u32 x); u64 math__bits__reverse_64(u64 x); u16 math__bits__reverse_bytes_16(u16 x); u32 math__bits__reverse_bytes_32(u32 x); u64 math__bits__reverse_bytes_64(u64 x); int math__bits__len_8(u8 x); int math__bits__len_16(u16 x); int math__bits__len_32(u32 x); int math__bits__len_64(u64 x); multi_return_u32_u32 math__bits__add_32(u32 x, u32 y, u32 carry); multi_return_u64_u64 math__bits__add_64(u64 x, u64 y, u64 carry); multi_return_u32_u32 math__bits__sub_32(u32 x, u32 y, u32 borrow); multi_return_u64_u64 math__bits__sub_64(u64 x, u64 y, u64 borrow); multi_return_u32_u32 math__bits__mul_32(u32 x, u32 y); VV_LOC multi_return_u32_u32 math__bits__mul_32_default(u32 x, u32 y); multi_return_u64_u64 math__bits__pure_v_but_overridden_by_amd64_mul_64(u64 x, u64 y); VV_LOC multi_return_u64_u64 math__bits__mul_64_default(u64 x, u64 y); multi_return_u32_u32 math__bits__mul_add_32(u32 x, u32 y, u32 z); VV_LOC multi_return_u32_u32 math__bits__mul_add_32_default(u32 x, u32 y, u32 z); multi_return_u64_u64 math__bits__pure_v_but_overridden_by_amd64_mul_add_64(u64 x, u64 y, u64 z); VV_LOC multi_return_u64_u64 math__bits__mul_add_64_default(u64 x, u64 y, u64 z); multi_return_u32_u32 math__bits__div_32(u32 hi, u32 lo, u32 y); VV_LOC multi_return_u32_u32 math__bits__div_32_default(u32 hi, u32 lo, u32 y); multi_return_u64_u64 math__bits__pure_v_but_overridden_by_amd64_div_64(u64 hi, u64 lo, u64 y1); VV_LOC multi_return_u64_u64 math__bits__div_64_default(u64 hi, u64 lo, u64 y1); u32 math__bits__rem_32(u32 hi, u32 lo, u32 y); u64 math__bits__rem_64(u64 hi, u64 lo, u64 y); multi_return_f64_int math__bits__normalize(f64 x); u32 math__bits__f32_bits(f32 f); f32 math__bits__f32_from_bits(u32 b); u64 math__bits__f64_bits(f64 f); f64 math__bits__f64_from_bits(u64 b); VV_LOC multi_return_u32_u32_u32 strconv__lsr96(u32 s2, u32 s1, u32 s0); VV_LOC multi_return_u32_u32_u32 strconv__lsl96(u32 s2, u32 s1, u32 s0); VV_LOC multi_return_u32_u32_u32 strconv__add96(u32 s2, u32 s1, u32 s0, u32 d2, u32 d1, u32 d0); VV_LOC multi_return_strconv__ParserState_strconv__PrepNumber strconv__parser(string s); VV_LOC u64 strconv__converter(strconv__PrepNumber* pn); _result_f64 strconv__atof64(string s, strconv__AtoF64Param param); f64 strconv__atof_quick(string s); u8 strconv__byte_to_lower(u8 c); _result_u64 strconv__common_parse_uint(string s, int _base, int _bit_size, bool error_on_non_digit, bool error_on_high_digit); multi_return_u64_int strconv__common_parse_uint2(string s, int _base, int _bit_size); _result_u64 strconv__parse_uint(string s, int _base, int _bit_size); _result_i64 strconv__common_parse_int(string _s, int base, int _bit_size, bool error_on_non_digit, bool error_on_high_digit); _result_i64 strconv__parse_int(string _s, int base, int _bit_size); VV_LOC _result_multi_return_i64_int strconv__atoi_common_check(string s); VV_LOC _result_i64 strconv__atoi_common(string s, i64 type_min, i64 type_max); _result_int strconv__atoi(string s); _result_i8 strconv__atoi8(string s); _result_i16 strconv__atoi16(string s); _result_i32 strconv__atoi32(string s); _result_i64 strconv__atoi64(string s); VV_LOC _result_i64 strconv__safe_add_64bits(i64 a, i64 b); VV_LOC _result_i64 strconv__safe_mul10_64bits(i64 a); VV_LOC _result_int strconv__atou_common_check(string s); VV_LOC _result_u64 strconv__atou_common(string s, u64 type_max); _result_u8 strconv__atou8(string s); _result_u16 strconv__atou16(string s); _result_u32 strconv__atou(string s); _result_u32 strconv__atou32(string s); _result_u64 strconv__atou64(string s); string strconv__Dec32_get_string_32(strconv__Dec32 d, bool neg, int i_n_digit, int i_pad_digit); VV_LOC multi_return_strconv__Dec32_bool strconv__f32_to_decimal_exact_int(u32 i_mant, u32 exp); VV_LOC strconv__Dec32 strconv__f32_to_decimal(u32 mant, u32 exp); string strconv__f32_to_str(f32 f, int n_digit); string strconv__f32_to_str_pad(f32 f, int n_digit); VV_LOC string strconv__Dec64_get_string_64(strconv__Dec64 d, bool neg, int i_n_digit, int i_pad_digit); VV_LOC multi_return_strconv__Dec64_bool strconv__f64_to_decimal_exact_int(u64 i_mant, u64 exp); VV_LOC strconv__Dec64 strconv__f64_to_decimal(u64 mant, u64 exp); string strconv__f64_to_str(f64 f, int n_digit); string strconv__f64_to_str_pad(f64 f, int n_digit); string strconv__format_str(string s, strconv__BF_param p); void strconv__format_str_sb(string s, strconv__BF_param p, strings__Builder* sb); void strconv__format_dec_sb(u64 d, strconv__BF_param p, strings__Builder* res); string strconv__f64_to_str_lnd1(f64 f, int dec_digit); string strconv__format_fl(f64 f, strconv__BF_param p); string strconv__format_es(f64 f, strconv__BF_param p); string strconv__remove_tail_zeros(string s); string strconv__ftoa_64(f64 f); string strconv__ftoa_long_64(f64 f); string strconv__ftoa_32(f32 f); string strconv__ftoa_long_32(f32 f); string strconv__format_int(i64 n, int radix); string strconv__format_uint(u64 n, int radix); string strconv__f32_to_str_l(f32 f); string strconv__f32_to_str_l_with_dot(f32 f); string strconv__f64_to_str_l(f64 f); string strconv__f64_to_str_l_with_dot(f64 f); string strconv__fxx_to_str_l_parse(string s); string strconv__fxx_to_str_l_parse_with_dot(string s); VV_LOC u32 strconv__bool_to_u32(bool b); VV_LOC u64 strconv__bool_to_u64(bool b); VV_LOC string strconv__get_string_special(bool neg, bool expZero, bool mantZero); VV_LOC u32 strconv__mul_shift_32(u32 m, u64 mul, int ishift); VV_LOC u32 strconv__mul_pow5_invdiv_pow2(u32 m, u32 q, int j); VV_LOC u32 strconv__mul_pow5_div_pow2(u32 m, u32 i, int j); VV_LOC u32 strconv__pow5_factor_32(u32 i_v); VV_LOC bool strconv__multiple_of_power_of_five_32(u32 v, u32 p); VV_LOC bool strconv__multiple_of_power_of_two_32(u32 v, u32 p); VV_LOC u32 strconv__log10_pow2(int e); VV_LOC u32 strconv__log10_pow5(int e); VV_LOC int strconv__pow5_bits(int e); VV_LOC u64 strconv__shift_right_128(strconv__Uint128 v, int shift); VV_LOC u64 strconv__mul_shift_64(u64 m, strconv__Uint128 mul, int shift); VV_LOC u32 strconv__pow5_factor_64(u64 v_i); VV_LOC bool strconv__multiple_of_power_of_five_64(u64 v, u32 p); VV_LOC bool strconv__multiple_of_power_of_two_64(u64 v, u32 p); int strconv__dec_digits(u64 n); void strconv__v_printf(string str, Array_voidptr pt); string strconv__v_sprintf(string str, Array_voidptr pt); VV_LOC void strconv__v_sprintf_panic(int idx, int len); VV_LOC f64 strconv__fabs(f64 x); string strconv__format_fl_old(f64 f, strconv__BF_param p); VV_LOC string strconv__format_es_old(f64 f, strconv__BF_param p); VV_LOC string strconv__remove_tail_zeros_old(string s); string strconv__format_dec_old(u64 d, strconv__BF_param p); int strconv__write_dec(i64 n, Array_u8* buf); int strconv__write_dec_u(u64 n, Array_u8* buf); VV_LOC void strconv__write_dec_u_digits(u64 n, Array_u8* buf, int offset, int ndigits); VV_LOC void builtin___memory_panic(string fname, isize size); u8* builtin___v_malloc(isize n); u8* builtin__malloc_noscan(isize n); VV_LOC u8* builtin__malloc_uninit(isize n); VV_LOC u64 builtin____at_least_one(u64 how_many); u8* builtin__malloc_uncollectable(isize n); u8* builtin__v_realloc(u8* b, isize n); u8* builtin__realloc_data(u8* old_data, int old_size, int new_size); u8* builtin__vcalloc(isize n); u8* builtin__vcalloc_noscan(isize n); void builtin___v_free(voidptr ptr); voidptr builtin__memdup(voidptr src, isize sz); voidptr builtin__memdup_noscan(voidptr src, isize sz); voidptr builtin__memdup_uncollectable(voidptr src, isize sz); voidptr builtin__memdup_align(voidptr src, isize sz, isize align); GCHeapUsage builtin__gc_heap_usage(void); usize builtin__gc_memory_use(void); VV_LOC int builtin__array_data_header_size(void); VV_LOC u64 builtin__array_data_allocation_size(u64 total_size); VV_LOC voidptr builtin__alloc_array_data(u64 total_size); VV_LOC voidptr builtin__alloc_array_data_uninit(u64 total_size); VV_LOC bool builtin__array_uses_noscan_data(array a); VV_LOC voidptr builtin__array_alloc_array_data_like(array a, u64 total_size); VV_LOC voidptr builtin__array_alloc_array_data_like_uninit(array a, u64 total_size); VV_LOC ArrayDataHeader* builtin__array_data_header(array a); VV_LOC bool builtin__array_buffer_has_slices(array a); VV_LOC void builtin__array_mark_buffer_has_slices(array* a); VV_LOC void builtin__array_set_managed_flags(array* a, bool is_slice); VV_LOC void builtin__array_clone_shallow_to_cap(array* a, int new_cap); VV_LOC int builtin__v_ni_index(int i, int len); VV_LOC array builtin____new_array(int mylen, int cap, int elm_size); VV_LOC array builtin____new_array_with_default(int mylen, int cap, int elm_size, voidptr val); VV_LOC array builtin____new_array_with_multi_default(int mylen, int cap, int elm_size, voidptr val); VV_LOC array builtin____new_array_with_array_default(int mylen, int cap, int elm_size, array val, int depth); VV_LOC array builtin__new_array_from_c_array(int len, int cap, int elm_size, voidptr c_array); void builtin__array_ensure_cap(array* a, int required); array builtin__array_repeat(array a, int count); array builtin__array_repeat_to_depth(array a, int count, int depth); VV_LOC bool builtin__array_needs_unique_shift(array a, int required); VV_LOC bool builtin__array_needs_unique_append(array a, int required); VV_LOC bool builtin__array_needs_unique_shrink(array a); void builtin__array_insert(array* a, int i, voidptr val); void builtin__array_prepend(array* a, voidptr val); void builtin__array_delete(array* a, int i); void builtin__array_delete_many(array* a, int i, int size); void builtin__array_clear(array* a); void builtin__array_reset(array* a); void builtin__array_trim(array* a, int index); void builtin__array_drop(array* a, int num); VV_LOC voidptr builtin__array_get_unsafe(array a, int i); VV_LOC voidptr builtin__array_get(array a, int i); VV_LOC voidptr builtin__array_get_i64(array a, i64 i); VV_LOC voidptr builtin__array_get_u64(array a, u64 i); VV_LOC voidptr builtin__array_get_ni(array a, int i); VV_LOC voidptr builtin__array_get_with_check(array a, int i); VV_LOC voidptr builtin__array_get_with_check_i64(array a, i64 i); VV_LOC voidptr builtin__array_get_with_check_u64(array a, u64 i); VV_LOC voidptr builtin__array_get_with_check_ni(array a, int i); voidptr builtin__array_first(array a); voidptr builtin__array_last(array a); voidptr builtin__array_pop_left(array* a); voidptr builtin__array_pop(array* a); void builtin__array_delete_last(array* a); VV_LOC array builtin__array_slice(array a, int start, int _end); VV_LOC array builtin__array_slice_ni(array a, int _start, int _end); VV_LOC array builtin__array_clone_static_to_depth(array a, int depth); array builtin__array_clone(array* a); array builtin__array_clone_to_depth(array* a, int depth); VV_LOC void builtin__array_set_unsafe(array* a, int i, voidptr val); VV_LOC void builtin__array_set(array* a, int i, voidptr val); VV_LOC void builtin__array_set_i64(array* a, i64 i, voidptr val); VV_LOC void builtin__array_set_u64(array* a, u64 i, voidptr val); VV_LOC void builtin__array_set_ni(array* a, int i, voidptr val); VV_LOC void builtin__copy_element_to(voidptr dest, voidptr src, int element_size); VV_LOC void builtin__array_push(array* a, voidptr val); void builtin__array_push_many(array* a, voidptr val, int size); void builtin__array_reverse_in_place(array* a); array builtin__array_reverse(array a); void builtin__array_free(array* a); array builtin__array_filter(array a, bool (*predicate)(voidptr _d1)); bool builtin__array_any(array a, bool (*predicate)(voidptr _d1)); int builtin__array_count(array a, bool (*predicate)(voidptr _d1)); bool builtin__array_all(array a, bool (*predicate)(voidptr _d1)); array builtin__array_map(array a, voidptr (*callback)(voidptr _d1)); void builtin__array_sort(array* a, int (*callback)(voidptr _d1, voidptr _d2)); array builtin__array_sorted(array* a, int (*callback)(voidptr _d1, voidptr _d2)); void builtin__array_sort_with_compare(array* a, int (*callback)(const void* const_a, const void* const_b)); array builtin__array_sorted_with_compare(array* a, int (*callback)(const void* const_a, const void* const_b)); bool builtin__array_contains(array a, voidptr value); int builtin__array_index(array a, voidptr value); int builtin__array_last_index(array a, voidptr value); void Array_string_free(Array_string* a); string Array_string_str(Array_string a); string Array_u8_hex(Array_u8 b); int builtin__copy(Array_u8* dst, Array_u8 src); void builtin__array_grow_cap(array* a, int amount); void builtin__array_grow_len(array* a, int amount); Array_voidptr builtin__array_pointers(array a); Array_u8 builtin__voidptr_vbytes(voidptr data, int len); Array_u8 builtin__u8_vbytes(u8* data, int len); void builtin__u8_free(u8* data); VV_LOC void builtin__panic_on_negative_len(int len); VV_LOC void builtin__panic_on_negative_cap(int cap); VV_LOC array builtin____new_array_noscan(int mylen, int cap, int elm_size); VV_LOC array builtin____new_array_with_default_noscan(int mylen, int cap, int elm_size, voidptr val); VV_LOC array builtin____new_array_with_multi_default_noscan(int mylen, int cap, int elm_size, voidptr val); VV_LOC array builtin____new_array_with_array_default_noscan(int mylen, int cap, int elm_size, array val, int depth); VV_LOC void builtin__array_push_noscan(array* a, voidptr val); VV_LOC void builtin__array_push_many_noscan(array* a, voidptr val, int size); VV_LOC bool builtin__autostr_type_in_stack(int typ); VV_LOC void builtin__autostr_type_push(int typ); VV_LOC void builtin__autostr_type_pop(void); VV_LOC bool builtin__autostr_addr_in_stack(voidptr addr); VV_LOC void builtin__autostr_addr_push(voidptr addr); VV_LOC void builtin__autostr_addr_pop(void); VV_LOC string builtin__autostr_array_circular(int len); void builtin__print_backtrace(void); bool builtin__print_backtrace_skipping_top_frames(int xskipframes); void builtin___v_exit(int code); _result_void builtin__at_exit(void (*cb)()); VV_LOC void builtin__v_segmentation_fault_handler(i32 signal_number); VV_LOC int builtin__v_fixed_index(int i, int len); VV_LOC int builtin__v_fixed_index_i64(i64 i, int len); VV_LOC int builtin__v_fixed_index_u64(u64 i, int len); VV_LOC int builtin__v_fixed_index_ni(int i, int len); VV_LOC int builtin__v_slice_index_i64(i64 i); VV_LOC int builtin__v_slice_index_u64(u64 i); Array_string builtin__arguments(void); string builtin__vcurrent_hash(void); u64 builtin__v_getpid(void); u64 builtin__v_gettid(void); bool builtin__isnil(voidptr v); VV_LOC void builtin__builtin_init(void); void builtin__panic_lasterr(string base); void builtin__gc_check_leaks(void); bool builtin__gc_is_enabled(void); void builtin__gc_enable(void); void builtin__gc_disable(void); void builtin__gc_collect(void); void builtin__gc_get_warn_proc(void); void builtin__gc_set_warn_proc(void (*cb)(char* msg, usize arg)); int builtin__vstrlen(u8* s); int builtin__vstrlen_char(char* s); voidptr builtin__vmemcpy(voidptr dest, const void* const_src, isize n); voidptr builtin__vmemmove(voidptr dest, const void* const_src, isize n); int builtin__vmemcmp(const void* const_s1, const void* const_s2, isize n); voidptr builtin__vmemset(voidptr s, int c, isize n); VV_LOC voidptr builtin__vsort_ptr_at(voidptr base, usize index, usize size); VV_LOC void builtin__vstable_sort_merge(voidptr source, voidptr dest, usize left, usize mid, usize right, usize size, int (*sort_cb)(const void* const_a, const void* const_b)); VV_LOC void builtin__vqsort(voidptr base, usize nmemb, usize size, int (*sort_cb)(const void* const_a, const void* const_b)); void builtin__chan_close(chan ch, Array_IError err); ChanState builtin__chan_try_pop(chan ch, voidptr obj); ChanState builtin__chan_try_push(chan ch, voidptr obj); VV_LOC void builtin___result_ok(voidptr data, _result* res, int size); VV_LOC void builtin___result_clone(_result* current, _result* res, int size); string builtin__IError_str(IError err); string builtin__Error_msg(Error err); int builtin__Error_code(Error err); string builtin__MessageError_str(MessageError err); string builtin__MessageError_msg(MessageError err); int builtin__MessageError_code(MessageError err); void builtin__MessageError_free(MessageError* err); IError builtin___v_error(string message); IError builtin__error_with_code(string message, int code); VV_LOC void builtin___option_none(voidptr data, _option* option, int size); VV_LOC void builtin___option_ok(voidptr data, _option* option, int size); VV_LOC void builtin___option_clone(_option* current, _option* option, int size); VV_LOC void builtin___result_ok_markused(void); VV_LOC string builtin__None___str(None__ _d1); string builtin__none_str(none _d1); int builtin__input_character(void); int builtin__print_character(u8 ch); string builtin__f64_str(f64 x); string builtin__f64_strg(f64 x); string builtin__float_literal_str(float_literal d); string builtin__f64_strsci(f64 x, int digit_num); string builtin__f64_strlong(f64 x); string builtin__f32_str(f32 x); string builtin__f32_strg(f32 x); string builtin__f32_strsci(f32 x, int digit_num); string builtin__f32_strlong(f32 x); f32 builtin__f32_abs(f32 a); f64 builtin__f64_abs(f64 a); f32 builtin__f32_min(f32 a, f32 b); f32 builtin__f32_max(f32 a, f32 b); f64 builtin__f64_min(f64 a, f64 b); f64 builtin__f64_max(f64 a, f64 b); bool builtin__f32_eq_epsilon(f32 a, f32 b); bool builtin__f64_eq_epsilon(f64 a, f64 b); VV_LOC u32 builtin__grapheme_hex_nibble(u8 c); VV_LOC u32 builtin__grapheme_hex_byte(string ranges, int i); VV_LOC u32 builtin__grapheme_range_value(string ranges, int value_idx); VV_LOC bool builtin__in_grapheme_ranges(rune r, string ranges); VV_LOC GraphemeBreakProperty builtin__grapheme_break_property(rune r); VV_LOC bool builtin__is_extended_pictographic(rune r); VV_LOC GraphemeState builtin__grapheme_state_from_rune(rune r, GraphemeBreakProperty prop); VV_LOC void builtin__GraphemeState_push(GraphemeState* gs, rune r, GraphemeBreakProperty prop); VV_LOC bool builtin__should_break_grapheme(GraphemeState gs, rune r, GraphemeBreakProperty prop); VV_LOC int builtin__utf8_rune_visible_width(rune r, GraphemeBreakProperty prop); VV_LOC Array_string builtin__string_graphemes_impl(string s); VV_LOC int builtin__utf8_grapheme_visible_length(string s); _option_rune builtin__input_rune(void); _option_rune builtin__InputRuneIterator_next(InputRuneIterator* self); InputRuneIterator builtin__input_rune_iterator(void); string builtin__ptr_str(voidptr ptr); string builtin__isize_str(isize x); string builtin__usize_str(usize x); string builtin__char_str(char* cptr); VV_LOC string builtin__int_str_l(int nn, int max); string builtin__i8_str(i8 n); string builtin__i16_str(i16 n); string builtin__u16_str(u16 n); string builtin__i32_str(i32 n); string builtin__int_hex_full(int nn); string builtin__int_str(int n); string builtin__u32_str(u32 nn); string builtin__int_literal_str(int_literal n); string builtin__i64_str(i64 nn); VV_LOC string builtin__impl_i64_to_string(i64 nn); string builtin__u64_str(u64 nn); string builtin__bool_str(bool b); VV_LOC string builtin__u64_to_hex(u64 nn, u8 len); VV_LOC string builtin__u64_to_hex_no_leading_zeros(u64 nn, u8 len); string builtin__u8_hex(u8 nn); string builtin__char_hex(char c); string builtin__rune_hex(rune r); string builtin__i8_hex(i8 nn); string builtin__u16_hex(u16 nn); string builtin__i16_hex(i16 nn); string builtin__u32_hex(u32 nn); string builtin__int_hex(int nn); string builtin__int_hex2(int n); string builtin__u64_hex(u64 nn); string builtin__i64_hex(i64 nn); string builtin__int_literal_hex(int_literal nn); string builtin__voidptr_str(voidptr nn); string builtin__byteptr_str(byteptr nn); string builtin__charptr_str(charptr nn); string builtin__u8_hex_full(u8 nn); string builtin__i8_hex_full(i8 nn); string builtin__u16_hex_full(u16 nn); string builtin__i16_hex_full(i16 nn); string builtin__u32_hex_full(u32 nn); string builtin__i64_hex_full(i64 nn); string builtin__voidptr_hex_full(voidptr nn); string builtin__int_literal_hex_full(int_literal nn); string builtin__u64_hex_full(u64 nn); string builtin__u8_str(u8 b); string builtin__u8_ascii_str(u8 b); string builtin__u8_str_escaped(u8 b); bool builtin__u8_is_capital(u8 c); string Array_u8_bytestr(Array_u8 b); _result_rune Array_u8_byterune(Array_u8 b); string builtin__u8_repeat(u8 b, int count); int builtin__int_min(int a, int b); int builtin__int_max(int a, int b); VV_LOC bool builtin__fast_string_eq(string a, string b); VV_LOC u64 builtin__map_hash_string(voidptr pkey); VV_LOC u64 builtin__map_hash_int_1(voidptr pkey); VV_LOC u64 builtin__map_hash_int_2(voidptr pkey); VV_LOC u64 builtin__map_hash_int_4(voidptr pkey); VV_LOC u64 builtin__map_hash_int_8(voidptr pkey); VV_LOC voidptr builtin__map_enum_fn(int kind, int esize); VV_LOC void builtin__DenseArray_zeros_to_end(DenseArray* d); VV_LOC DenseArray builtin__new_dense_array(int key_bytes, int value_bytes); VV_LOC voidptr builtin__DenseArray_key(DenseArray* d, int i); VV_LOC voidptr builtin__DenseArray_value(DenseArray* d, int i); VV_LOC bool builtin__DenseArray_has_index(DenseArray* d, int i); VV_LOC void builtin__DenseArray_trim_deleted_tail(DenseArray* d); VV_LOC int builtin__DenseArray_expand(DenseArray* d); VV_LOC bool builtin__map_eq_string(voidptr a, voidptr b); VV_LOC bool builtin__map_eq_int_1(voidptr a, voidptr b); VV_LOC bool builtin__map_eq_int_2(voidptr a, voidptr b); VV_LOC bool builtin__map_eq_int_4(voidptr a, voidptr b); VV_LOC bool builtin__map_eq_int_8(voidptr a, voidptr b); VV_LOC bool builtin__map_map_eq(map a, map b); VV_LOC void builtin__map_clone_string(voidptr dest, voidptr pkey); VV_LOC void builtin__map_clone_int_1(voidptr dest, voidptr pkey); VV_LOC void builtin__map_clone_int_2(voidptr dest, voidptr pkey); VV_LOC void builtin__map_clone_int_4(voidptr dest, voidptr pkey); VV_LOC void builtin__map_clone_int_8(voidptr dest, voidptr pkey); VV_LOC void builtin__map_free_string(voidptr pkey); VV_LOC void builtin__map_free_nop(voidptr _d1); VV_LOC map builtin__new_map(int key_bytes, int value_bytes, u64 (*hash_fn)(voidptr _d1), bool (*key_eq_fn)(voidptr _d1, voidptr _d2), void (*clone_fn)(voidptr _d1, voidptr _d2), void (*free_fn)(voidptr _d1)); VV_LOC map builtin__new_map_init(u64 (*hash_fn)(voidptr _d1), bool (*key_eq_fn)(voidptr _d1, voidptr _d2), void (*clone_fn)(voidptr _d1, voidptr _d2), void (*free_fn)(voidptr _d1), int n, int key_bytes, int value_bytes, voidptr keys, voidptr values); map builtin__map_move(map* m); void builtin__map_clear(map* m); VV_LOC multi_return_u32_u32 builtin__map_key_to_index(map* m, voidptr pkey); VV_LOC multi_return_u32_u32 builtin__map_meta_less(map* m, u32 _index, u32 _metas); VV_LOC void builtin__map_meta_greater(map* m, u32 _index, u32 _metas, u32 kvi); VV_LOC void builtin__map_ensure_extra_metas_grow(map* m); VV_LOC void builtin__map_ensure_extra_metas(map* m, u32 probe_count); VV_LOC void builtin__map_set(map* m, voidptr key, voidptr value); VV_LOC void builtin__map_expand(map* m); VV_LOC void builtin__map_rehash(map* m); VV_LOC void builtin__map_reserve_metas(map* m, u32 meta_bytes); void builtin__map_reserve(map* m, u32 n); VV_LOC void builtin__map_cached_rehash(map* m, u32 old_cap); VV_LOC voidptr builtin__map_get_and_set(map* m, voidptr key, voidptr zero); VV_LOC voidptr builtin__map_get(map* m, voidptr key, voidptr zero); VV_LOC voidptr builtin__map_get_check(map* m, voidptr key); VV_LOC bool builtin__map_exists(map* m, voidptr key); VV_LOC void builtin__DenseArray_delete(DenseArray* d, int i); void builtin__map_delete(map* m, voidptr key); array builtin__map_keys(map* m); array builtin__map_values(map* m); VV_LOC DenseArray builtin__DenseArray_clone(DenseArray* d); map builtin__map_clone(map* m); void builtin__map_free(map* m); void builtin__VAssertMetaInfo_free(VAssertMetaInfo* ami); void builtin__IError_free(IError* ie); void builtin__panic_option_not_set(string s); void builtin__panic_result_not_set(string s); void builtin___v_panic(string s); string builtin__c_error_number_str(int errnum); void builtin__panic_n(string s, i64 number1); void builtin__panic_n2(string s, i64 number1, i64 number2); VV_LOC void builtin__panic_n3(string s, i64 number1, i64 number2, i64 number3); void builtin__panic_error_number(string basestr, int errnum); VV_LOC void builtin__set_stream_unbuffered(FILE* stream); void builtin__eprintln(string s); void builtin__eprint(string s); void builtin__flush_stdout(void); void builtin__flush_stderr(void); void builtin__unbuffer_stdout(void); void builtin__print(string s); void builtin__println(string s); VV_LOC void builtin___writeln_to_fd(int fd, string s); VV_LOC void builtin___write_buf_to_fd(int fd, u8* buf, int buf_len); string builtin__reuse_data_as_string(Array_u8 buffer); Array_u8 builtin__reuse_string_as_data(string s); string builtin__rune_str(rune c); string Array_rune_string(Array_rune ra); string builtin__rune_repeat(rune c, int count); Array_u8 builtin__rune_bytes(rune c); int builtin__rune_length_in_bytes(rune c); rune builtin__rune_to_upper(rune c); rune builtin__rune_to_lower(rune c); rune builtin__rune_to_title(rune c); VV_LOC rune builtin__rune_map_to(rune c, MapMode mode); VV_LOC int builtin__mapnode_find_key(mapnode* n, string k); VV_LOC bool builtin__mapnode_remove_key(mapnode* n, string k); VV_LOC void builtin__mapnode_remove_from_leaf(mapnode* n, int idx); VV_LOC void builtin__mapnode_remove_from_non_leaf(mapnode* n, int idx); VV_LOC void builtin__mapnode_fill(mapnode* n, int idx); VV_LOC void builtin__mapnode_borrow_from_prev(mapnode* n, int idx); VV_LOC void builtin__mapnode_borrow_from_next(mapnode* n, int idx); VV_LOC void builtin__mapnode_merge(mapnode* n, int idx); void builtin__SortedMap_delete(SortedMap* m, string key); VV_LOC int builtin__mapnode_subkeys(mapnode* n, Array_string* keys, int at); Array_string builtin__SortedMap_keys(SortedMap* m); VV_LOC void builtin__mapnode_free(mapnode* n); void builtin__SortedMap_free(SortedMap* m); Array_rune builtin__string_runes(string s); Array_string builtin__string_graphemes(string s); string builtin__cstring_to_vstring(const char* const_s); string builtin__tos_clone(const u8* const_s); string builtin__tos(u8* s, int len); string builtin__tos2(u8* s); string builtin__tos3(char* s); string builtin__tos4(u8* s); string builtin__tos5(char* s); string builtin__u8_vstring(u8* bp); string builtin__u8_vstring_with_len(u8* bp, int len); string builtin__char_vstring(char* cp); string builtin__char_vstring_with_len(char* cp, int len); string builtin__u8_vstring_literal(u8* bp); string builtin__u8_vstring_literal_with_len(u8* bp, int len); string builtin__char_vstring_literal(char* cp); string builtin__char_vstring_literal_with_len(char* cp, int len); int builtin__string_len_utf8(string s); bool builtin__string_is_pure_ascii(string s); string builtin__string_clone(string a); string builtin__string_replace_once(string s, string rep, string with); string builtin__string_replace(string s, string rep, string with); string builtin__string_replace_each(string s, Array_string vals); string builtin__string_format(string s, Array_string args); string builtin__string_replace_char(string s, u8 rep, u8 with, int repeat); string builtin__string_normalize_tabs(string s, int tab_len); string builtin__string_expand_tabs(string s, int tab_len); bool builtin__string_bool(string s); i8 builtin__string_i8(string s); i16 builtin__string_i16(string s); i32 builtin__string_i32(string s); int builtin__string_int(string s); i64 builtin__string_i64(string s); f32 builtin__string_f32(string s); f64 builtin__string_f64(string s); Array_u8 builtin__string_u8_array(string s); u8 builtin__string_u8(string s); u16 builtin__string_u16(string s); u32 builtin__string_u32(string s); u64 builtin__string_u64(string s); _result_u64 builtin__string_parse_uint(string s, int _base, int _bit_size); _result_i64 builtin__string_parse_int(string s, int _base, int _bit_size); VV_LOC bool builtin__string__eq(string s, string a); int builtin__string_compare(string s, string a); VV_LOC bool builtin__string__lt(string s, string a); VV_LOC string builtin__string__plus(string s, string a); VV_LOC string builtin__string_plus_many(int data_len, string* input_base); VV_LOC string builtin__string_plus_two(string s, string a, string b); Array_string builtin__string_split_any(string s, string delim); Array_string builtin__string_rsplit_any(string s, string delim); Array_string builtin__string_split(string s, string delim); Array_string builtin__string_rsplit(string s, string delim); _option_multi_return_string_string builtin__string_split_once(string s, string delim); _option_multi_return_string_string builtin__string_rsplit_once(string s, string delim); Array_string builtin__string_split_n(string s, string delim, int n); Array_string builtin__string_split_nth(string s, string delim, int nth); Array_string builtin__string_rsplit_nth(string s, string delim, int nth); Array_string builtin__string_split_into_lines(string s); Array_string builtin__string_split_by_space(string s); string builtin__string_substr(string s, int start, int _end); string builtin__string_substr_unsafe(string s, int start, int _end); string builtin__string_substr_or(string s, int start, int _end, string fallback); _result_string builtin__string_substr_with_check(string s, int start, int _end); string builtin__string_substr_ni(string s, int _start, int _end); int builtin__string_index_(string s, string p); _option_int builtin__string_index(string s, string p); _option_int builtin__string_last_index(string s, string needle); VV_LOC int builtin__string_index_kmp(string s, string p); int builtin__string_index_any(string s, string chars); VV_LOC int builtin__string_index_last_(string s, string p); _option_int builtin__string_index_after(string s, string p, int start); int builtin__string_index_after_(string s, string p, int start); int builtin__string_index_u8(string s, u8 c); int builtin__string_last_index_u8(string s, u8 c); int builtin__string_count(string s, string substr); bool builtin__string_contains_u8(string s, u8 x); bool builtin__string_contains(string s, string substr); bool builtin__string_contains_any(string s, string chars); bool builtin__string_contains_only(string s, string chars); bool builtin__string_contains_any_substr(string s, Array_string substrs); bool builtin__string_starts_with(string s, string p); bool builtin__string_ends_with(string s, string p); string builtin__string_to_lower_ascii(string s); string builtin__string_to_lower(string s); bool builtin__string_is_lower(string s); string builtin__string_to_upper_ascii(string s); string builtin__string_to_upper(string s); bool builtin__string_is_upper(string s); string builtin__string_capitalize(string s); string builtin__string_uncapitalize(string s); bool builtin__string_is_capital(string s); bool builtin__string_starts_with_capital(string s); string builtin__string_title(string s); bool builtin__string_is_title(string s); string builtin__string_find_between(string s, string start, string end); string builtin__string_trim_space(string s); string builtin__string_trim_space_left(string s); string builtin__string_trim_space_right(string s); string builtin__string_trim(string s, string cutset); multi_return_int_int builtin__string_trim_indexes(string s, string cutset); VV_LOC string builtin__string_trim_chars(string s, string cutset, TrimMode mode); VV_LOC string builtin__string_trim_runes(string s, string cutset, TrimMode mode); string builtin__string_trim_left(string s, string cutset); string builtin__string_trim_right(string s, string cutset); string builtin__string_trim_string_left(string s, string str); string builtin__string_trim_string_right(string s, string str); int builtin__compare_strings(string* a, string* b); VV_LOC int builtin__compare_strings_by_len(string* a, string* b); VV_LOC int builtin__compare_lower_strings(string* a, string* b); void Array_string_sort_ignore_case(Array_string* s); void Array_string_sort_by_len(Array_string* s); string builtin__string_str(string s); VV_LOC u8 builtin__string_at(string s, int idx); VV_LOC u8 builtin__string_at_i64(string s, i64 idx); VV_LOC u8 builtin__string_at_u64(string s, u64 idx); VV_LOC u8 builtin__string_at_ni(string s, int idx); VV_LOC _option_u8 builtin__string_at_with_check(string s, int idx); VV_LOC _option_u8 builtin__string_at_with_check_i64(string s, i64 idx); VV_LOC _option_u8 builtin__string_at_with_check_u64(string s, u64 idx); VV_LOC _option_u8 builtin__string_at_with_check_ni(string s, int idx); bool builtin__string_is_oct(string str); bool builtin__string_is_bin(string str); bool builtin__string_is_hex(string str); bool builtin__string_is_int(string str); bool builtin__u8_is_space(u8 c); bool builtin__u8_is_digit(u8 c); bool builtin__u8_is_hex_digit(u8 c); bool builtin__u8_is_oct_digit(u8 c); bool builtin__u8_is_bin_digit(u8 c); bool builtin__u8_is_letter(u8 c); bool builtin__u8_is_alnum(u8 c); void builtin__string_free(string* s); string builtin__string_before(string s, string sub); string builtin__string_all_before(string s, string sub); string builtin__string_all_before_last(string s, string sub); string builtin__string_all_after(string s, string sub); string builtin__string_all_after_last(string s, string sub); string builtin__string_all_after_first(string s, string sub); string builtin__string_after(string s, string sub); string builtin__string_after_char(string s, u8 sub); string Array_string_join(Array_string a, string sep); string Array_string_join_lines(Array_string s); string builtin__string_reverse(string s); string builtin__string_limit(string s, int max); int builtin__string_hash(string s); Array_u8 builtin__string_bytes(string s); string builtin__string_repeat(string s, int count); Array_string builtin__string_fields(string s); string builtin__string_strip_margin(string s); string builtin__string_strip_margin_custom(string s, u8 del); string builtin__string_trim_indent(string s); int builtin__string_indent_width(string s); bool builtin__string_is_blank(string s); bool builtin__string_match_glob(string name, string pattern); bool builtin__string_is_ascii(string s); bool builtin__string_is_identifier(string s); string builtin__string_camel_to_snake(string s); string builtin__string_snake_to_camel(string s); string builtin__string_wrap(string s, WrapConfig config); string builtin__string_hex(string s); VV_LOC string builtin__data_to_hex_string(u8* data, int len); RunesIterator builtin__string_runes_iterator(string s); _option_rune builtin__RunesIterator_next(RunesIterator* ri); Array_u8 builtin__byteptr_vbytes(byteptr data, int len); string builtin__byteptr_vstring(byteptr bp); string builtin__byteptr_vstring_with_len(byteptr bp, int len); string builtin__charptr_vstring(charptr cp); string builtin__charptr_vstring_with_len(charptr cp, int len); string builtin__byteptr_vstring_literal(byteptr bp); string builtin__byteptr_vstring_literal_with_len(byteptr bp, int len); string builtin__charptr_vstring_literal(charptr cp); string builtin__charptr_vstring_literal_with_len(charptr cp, int len); string builtin__StrIntpType_str(StrIntpType x); VV_LOC f32 builtin__fabs32(f32 x); VV_LOC f64 builtin__fabs64(f64 x); VV_LOC u64 builtin__abs64(i64 x); u64 builtin__get_str_intp_u64_format(StrIntpType fmt_type, int in_width, int in_precision, bool in_tail_zeros, bool in_sign, u8 in_pad_ch, int in_base, bool in_upper_case); u32 builtin__get_str_intp_u32_format(StrIntpType fmt_type, int in_width, int in_precision, bool in_tail_zeros, bool in_sign, u8 in_pad_ch, int in_base, bool in_upper_case); VV_LOC void builtin__StrIntpData_process_str_intp_data(StrIntpData* data, strings__Builder* sb); string builtin__str_intp(int data_len, StrIntpData* input_base); string builtin__str_intp_sq(string in_str); string builtin__str_intp_rune(string in_str); string builtin__str_intp_g32(string in_str); string builtin__str_intp_g64(string in_str); string builtin__str_intp_sub(string base_str, string in_str); u16* builtin__string_to_wide(string _str, ToWideConfig param); string builtin__string_from_wide(u16* _wstr); string builtin__string_from_wide2(u16* _wstr, int len); Array_u8 builtin__wide_to_ansi(u16* _wstr); int builtin__utf8_char_len(u8 b); string builtin__utf32_to_str(u32 code); string builtin__utf32_to_str_no_malloc(u32 code, u8* buf); int builtin__utf32_decode_to_buffer(u32 code, u8* buf); int builtin__string_utf32_code(string _rune); _result_rune Array_u8_utf8_to_utf32(Array_u8 _bytes); VV_LOC bool builtin__utf8_is_continuation(u8 b); VV_LOC multi_return_rune_int builtin__utf8_decode_rune(u8* _bytes, int available_len); VV_LOC rune builtin__impl_utf8_to_utf32(u8* _bytes, int _bytes_len); int builtin__utf8_str_visible_length(string s); Array_u8 builtin__string_to_ansi_not_null_terminated(string _str); bool builtin__ArrayFlags_is_empty(ArrayFlags* e); bool builtin__ArrayFlags_has(ArrayFlags* e, ArrayFlags flag_); bool builtin__ArrayFlags_all(ArrayFlags* e, ArrayFlags flag_); void builtin__ArrayFlags_set(ArrayFlags* e, ArrayFlags flag_); void builtin__ArrayFlags_set_all(ArrayFlags* e); void builtin__ArrayFlags_clear(ArrayFlags* e, ArrayFlags flag_); void builtin__ArrayFlags_clear_all(ArrayFlags* e); void builtin__ArrayFlags_toggle(ArrayFlags* e, ArrayFlags flag_); ArrayFlags builtin__ArrayFlags__static__zero(void); f64 math__inf(int sign); f64 math__nan(void); bool math__is_nan(f64 f); bool math__is_inf(f64 f, int sign); bool math__is_finite(f64 f); multi_return_f64_int math__normalize(f64 x); f64 math__cbrt(f64 a); f64 math__mod(f64 x, f64 y); f64 math__fmod(f64 x, f64 y); i64 math__gcd(i64 a_, i64 b_); multi_return_i64_i64_i64 math__egcd(i64 a, i64 b); i64 math__lcm(i64 a, i64 b); f64 math__erf(f64 a); f64 math__erfc(f64 a); f64 math__exp(f64 x); f64 math__exp2(f64 x); f64 math__ldexp(f64 frac, int exp); f64 math__pure_v_but_overridden_by_c_exp(f64 x); f64 math__pure_v_but_overridden_by_c_exp2(f64 x); f64 math__pure_v_but_overridden_by_c_ldexp(f64 frac, int exp); multi_return_f64_int math__frexp(f64 x); f64 math__expm1(f64 x); VV_LOC f64 math__expmulti(f64 hi, f64 lo, int k); f64 math__factorial(f64 n); f64 math__log_factorial(f64 n); VV_LOC f64 math__log_factorial_asymptotic_expansion(int n); i64 math__factoriali(int n); f64 math__floor(f64 x); f32 math__floorf(f32 x); f64 math__ceil(f64 x); f64 math__trunc(f64 x); f64 math__round(f64 x); f64 math__round_sig(f64 x, int sig_digits); f64 math__round_to_even(f64 x); VV_LOC u64 math__safe_shift(u64 value, u64 shift); VV_LOC bool math__is_neg_int(f64 x); VV_LOC multi_return_f64_f64 math__stirling(f64 x); f64 math__gamma(f64 a); VV_LOC f64 math__gamma_too_small(f64 x, f64 z); f64 math__log_gamma(f64 x); multi_return_f64_int math__log_gamma_sign(f64 a); VV_LOC f64 math__sin_pi(f64 x_); f64 math__hypot(f64 x, f64 y); math__BezierPoint math__cubic_bezier(f64 t, Array_math__BezierPoint p); math__BezierPoint math__cubic_bezier_a(f64 t, Array_f64 x, Array_f64 y); math__BezierPoint math__cubic_bezier_fa(f64 t, Array_fixed_f64_4 x, Array_fixed_f64_4 y); math__BezierPoint math__cubic_bezier_coords(f64 t, f64 x0, f64 x1, f64 x2, f64 x3, f64 y0, f64 y1, f64 y2, f64 y3); f64 math__acosh(f64 x); f64 math__asinh(f64 x); f64 math__atanh(f64 x); VV_LOC f64 math__xatan(f64 x); VV_LOC f64 math__satan(f64 x); f64 math__atan(f64 x); f64 math__atan2(f64 y, f64 x); f64 math__asin(f64 x_); f64 math__acos(f64 x); f64 math__log(f64 x); f64 math__log2(f64 x); f64 math__log10(f64 x); f64 math__log1p(f64 x); f64 math__log_b(f64 x); f32 math__logf(f32 x); f64 math__log_n(f64 x, f64 b); f64 math__pure_v_but_overridden_by_c_log10(f64 x); f64 math__pure_v_but_overridden_by_c_log2(f64 x); f64 math__pure_v_but_overridden_by_c_log1p(f64 x); f64 math__pure_v_but_overridden_by_c_log_b(f64 x); int math__ilog_b(f64 x); VV_LOC int math__ilog_b_(f64 x_); f64 math__pure_v_but_overridden_by_c_log(f64 a); f64 math__aprox_sin(f64 a); f64 math__aprox_cos(f64 a); f64 math__copysign(f64 x, f64 y); f64 math__degrees(f64 radians); f64 math__radians(f64 degrees); f64 math__angle_diff(f64 radian_a, f64 radian_b); Array_int math__digits(i64 num, math__DigitParams params); int math__count_digits(i64 number); multi_return_f64_f64 math__minmax(f64 a, f64 b); f64 math__clamp(f64 x, f64 a, f64 b); f64 math__sign(f64 n); int math__signi(f64 n); bool math__signbit(f64 x); bool math__tolerance(f64 actual, f64 expected, f64 tol); bool math__close(f64 actual, f64 expected); bool math__veryclose(f64 actual, f64 expected); bool math__alike(f64 a, f64 b); multi_return_f64_f64 math__modf(f64 f); f32 math__nextafter32(f32 x, f32 y); f64 math__nextafter(f64 x, f64 y); VV_LOC multi_return_f64_f64 math__ChebSeries_eval_e(math__ChebSeries cs, f64 x); f64 math__pow(f64 x, f64 y); f32 math__powf(f32 a, f32 b); f32 math__pure_v_but_overridden_by_c_powf(f32 a, f32 b); f64 math__pow10(int n); i64 math__powi(i64 a, i64 b); VV_LOC bool math__is_odd_int(f64 x); f64 math__pure_v_but_overridden_by_c_pow(f64 x, f64 y); f64 math__q_rsqrt(f64 x); f64 math__scalbn(f64 x, int n_); f64 math__cos(f64 a); f64 math__sin(f64 a); f32 math__cosf(f32 a); f32 math__sinf(f32 a); f64 math__pure_v_but_overridden_by_c_sin(f64 x); f64 math__pure_v_but_overridden_by_c_cos(f64 x); f32 math__pure_v_but_overridden_by_c_cosf(f32 a); f32 math__pure_v_but_overridden_by_c_sinf(f32 a); multi_return_f64_f64 math__sincos(f64 x); f64 math__sinh(f64 x_); f64 math__cosh(f64 x); f64 math__sqrt(f64 a); f32 math__sqrtf(f32 a); f64 math__pure_v_but_overridden_by_c_sqrt(f64 a); f32 math__pure_v_but_overridden_by_c_sqrtf(f32 a); i64 math__sqrti(i64 a); f32 math__tanf(f32 a); f64 math__tan(f64 a); f32 math__pure_v_but_overridden_by_c_tanf(f32 a); f64 math__cot(f64 a); f64 math__tanh(f64 x); u32 math__f32_bits(f32 f); f32 math__f32_from_bits(u32 b); u64 math__f64_bits(f64 f); f64 math__f64_from_bits(u64 b); f64 math__with_set_low_word(f64 f, u32 lo); f64 math__with_set_high_word(f64 f, u32 hi); u32 math__get_high_word(f64 f); VV_LOC void main__vf_init(void); VV_EXP void vf_init(void); // exported fn main.vf_init VV_LOC int main__vf_add(int a, int b); VV_EXP int vf_add(int a, int b); // exported fn main.vf_add VV_LOC char* main__vf_greet(char* name); VV_EXP char* vf_greet(char* name); // exported fn main.vf_greet VV_LOC void main__vf_free(voidptr p); VV_EXP void vf_free(voidptr p); // exported fn main.vf_free VV_LOC void main__vf_mandelbrot(u8* buf, int w, int h, f64 cx, f64 cy, f64 scale, int max_iter, int y0, int y1); VV_EXP void vf_mandelbrot(u8* buf, int w, int h, f64 cx, f64 cy, f64 scale, int max_iter, int y0, int y1); // exported fn main.vf_mandelbrot VV_LOC void main__main(void); f64 math__abs_T_f64(f64 a); static bool Array_rune_arr_eq(Array_rune a, Array_rune b); static bool builtin__closure__ClosureLifetimeState_struct_eq(builtin__closure__ClosureLifetimeState a, builtin__closure__ClosureLifetimeState b); static bool Array_builtin__closure__ClosureLifetimeRecord_arr_eq(Array_builtin__closure__ClosureLifetimeRecord a, Array_builtin__closure__ClosureLifetimeRecord b); static bool builtin__closure__ClosureLifetimeRecord_struct_eq(builtin__closure__ClosureLifetimeRecord a, builtin__closure__ClosureLifetimeRecord b); static bool Array_builtin__closure__ClosureLifetimeFrame_arr_eq(Array_builtin__closure__ClosureLifetimeFrame a, Array_builtin__closure__ClosureLifetimeFrame b); static bool builtin__closure__ClosureLifetimeFrame_struct_eq(builtin__closure__ClosureLifetimeFrame a, builtin__closure__ClosureLifetimeFrame b); // V global/const non-precomputed definitions: static string _const_math__bits__overflow_error; // a string literal, inited later static string _const_math__bits__divide_error; // a string literal, inited later static string _const_strconv__digit_pairs; // a string literal, inited later static string _const_strconv__base_digits; // a string literal, inited later static string _const_grapheme_control_ranges; // a string literal, inited later static string _const_grapheme_extend_ranges; // a string literal, inited later static string _const_grapheme_spacing_mark_ranges; // a string literal, inited later static string _const_grapheme_prepend_ranges; // a string literal, inited later static string _const_grapheme_extended_pictographic_ranges; // a string literal, inited later static string _const_digit_pairs; // a string literal, inited later static string _const_si_s_code; // a string literal, inited later static string _const_si_g32_code; // a string literal, inited later static string _const_si_g64_code; // a string literal, inited later builtin__closure__Closure g_closure; // global 6 static Array_fixed_u8_15 _const_builtin__closure__closure_thunk; // inited later static Array_fixed_u8_6 _const_builtin__closure__closure_get_data_bytes; // inited later static const u32 _const_math__bits__de_bruijn32 = 125613361; // precomputed2 static Array_fixed_u8_32 _const_math__bits__de_bruijn32tab = {((u8)(0)), 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9}; // fixed array const static const u64 _const_math__bits__de_bruijn64 = 285870213051353865U; // precomputed2 static Array_fixed_u8_64 _const_math__bits__de_bruijn64tab = {((u8)(0)), 1, 56, 2, 57, 49, 28, 3, 61, 58, 42, 50, 38, 29, 17, 4, 62, 47, 59, 36, 45, 43, 51, 22, 53, 39, 33, 30, 24, 18, 12, 5, 63, 55, 48, 27, 60, 41, 37, 16, 46, 35, 44, 21, 52, 32, 23, 11, 54, 26, 40, 15, 34, 20, 31, 10, 25, 14, 19, 9, 13, 8, 7, 6}; // fixed array const static const u64 _const_math__bits__m0 = 6148914691236517205U; // precomputed2 static const u64 _const_math__bits__m1 = 3689348814741910323U; // precomputed2 static const u64 _const_math__bits__m2 = 1085102592571150095U; // precomputed2 static const u64 _const_math__bits__m3 = 71777214294589695U; // precomputed2 static const u64 _const_math__bits__m4 = 281470681808895U; // precomputed2 static const u8 _const_math__bits__n8 = 8; // precomputed2 static const u16 _const_math__bits__n16 = 16; // precomputed2 static const u32 _const_math__bits__n32 = 32; // precomputed2 static const u64 _const_math__bits__n64 = 64U; // precomputed2 static const u64 _const_math__bits__two32 = 4294967296U; // precomputed2 static const u64 _const_math__bits__mask32 = 4294967295U; // precomputed2 static Array_fixed_u8_256 _const_math__bits__ntz_8_tab = {((u8)(0x08)), 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x06, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x07, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x06, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00}; // fixed array const static Array_fixed_u8_256 _const_math__bits__pop_8_tab = {((u8)(0x00)), 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 0x05, 0x06, 0x06, 0x07, 0x06, 0x07, 0x07, 0x08}; // fixed array const static Array_fixed_u8_256 _const_math__bits__rev_8_tab = {((u8)(0x00)), 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff}; // fixed array const static Array_fixed_u8_256 _const_math__bits__len_8_tab = {((u8)(0x00)), 0x01, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}; // fixed array const static const u32 _const_strconv__single_plus_zero = 0; // precomputed2 static const u32 _const_strconv__single_minus_zero = 2147483648; // precomputed2 static const u32 _const_strconv__single_plus_infinity = 2139095040; // precomputed2 static const u32 _const_strconv__single_minus_infinity = 4286578688; // precomputed2 static const u64 _const_strconv__double_plus_zero = 0U; // precomputed2 static const u64 _const_strconv__double_minus_zero = 9223372036854775808U; // precomputed2 static const u64 _const_strconv__double_plus_infinity = 9218868437227405312U; // precomputed2 static const u64 _const_strconv__double_minus_infinity = 18442240474082181120U; // precomputed2 static const u32 _const_strconv__c_ten = 10; // precomputed2 static Array_fixed_u64_309 _const_strconv__pos_exp = {((u64)(0x3ff0000000000000LL)), ((u64)(0x4024000000000000LL)), ((u64)(0x4059000000000000LL)), ((u64)(0x408f400000000000LL)), ((u64)(0x40c3880000000000LL)), ((u64)(0x40f86a0000000000LL)), ((u64)(0x412e848000000000LL)), ((u64)(0x416312d000000000LL)), ((u64)(0x4197d78400000000LL)), ((u64)(0x41cdcd6500000000LL)), ((u64)(0x4202a05f20000000LL)), ((u64)(0x42374876e8000000LL)), ((u64)(0x426d1a94a2000000LL)), ((u64)(0x42a2309ce5400000LL)), ((u64)(0x42d6bcc41e900000LL)), ((u64)(0x430c6bf526340000LL)), ((u64)(0x4341c37937e08000LL)), ((u64)(0x4376345785d8a000LL)), ((u64)(0x43abc16d674ec800LL)), ((u64)(0x43e158e460913d00LL)), ((u64)(0x4415af1d78b58c40LL)), ((u64)(0x444b1ae4d6e2ef50LL)), ((u64)(0x4480f0cf064dd592LL)), ((u64)(0x44b52d02c7e14af6LL)), ((u64)(0x44ea784379d99db4LL)), ((u64)(0x45208b2a2c280291LL)), ((u64)(0x4554adf4b7320335LL)), ((u64)(0x4589d971e4fe8402LL)), ((u64)(0x45c027e72f1f1281LL)), ((u64)(0x45f431e0fae6d721LL)), ((u64)(0x46293e5939a08ceaLL)), ((u64)(0x465f8def8808b024LL)), ((u64)(0x4693b8b5b5056e17LL)), ((u64)(0x46c8a6e32246c99cLL)), ((u64)(0x46fed09bead87c03LL)), ((u64)(0x4733426172c74d82LL)), ((u64)(0x476812f9cf7920e3LL)), ((u64)(0x479e17b84357691bLL)), ((u64)(0x47d2ced32a16a1b1LL)), ((u64)(0x48078287f49c4a1dLL)), ((u64)(0x483d6329f1c35ca5LL)), ((u64)(0x48725dfa371a19e7LL)), ((u64)(0x48a6f578c4e0a061LL)), ((u64)(0x48dcb2d6f618c879LL)), ((u64)(0x4911efc659cf7d4cLL)), ((u64)(0x49466bb7f0435c9eLL)), ((u64)(0x497c06a5ec5433c6LL)), ((u64)(0x49b18427b3b4a05cLL)), ((u64)(0x49e5e531a0a1c873LL)), ((u64)(0x4a1b5e7e08ca3a8fLL)), ((u64)(0x4a511b0ec57e649aLL)), ((u64)(0x4a8561d276ddfdc0LL)), ((u64)(0x4ababa4714957d30LL)), ((u64)(0x4af0b46c6cdd6e3eLL)), ((u64)(0x4b24e1878814c9ceLL)), ((u64)(0x4b5a19e96a19fc41LL)), ((u64)(0x4b905031e2503da9LL)), ((u64)(0x4bc4643e5ae44d13LL)), ((u64)(0x4bf97d4df19d6057LL)), ((u64)(0x4c2fdca16e04b86dLL)), ((u64)(0x4c63e9e4e4c2f344LL)), ((u64)(0x4c98e45e1df3b015LL)), ((u64)(0x4ccf1d75a5709c1bLL)), ((u64)(0x4d03726987666191LL)), ((u64)(0x4d384f03e93ff9f5LL)), ((u64)(0x4d6e62c4e38ff872LL)), ((u64)(0x4da2fdbb0e39fb47LL)), ((u64)(0x4dd7bd29d1c87a19LL)), ((u64)(0x4e0dac74463a989fLL)), ((u64)(0x4e428bc8abe49f64LL)), ((u64)(0x4e772ebad6ddc73dLL)), ((u64)(0x4eacfa698c95390cLL)), ((u64)(0x4ee21c81f7dd43a7LL)), ((u64)(0x4f16a3a275d49491LL)), ((u64)(0x4f4c4c8b1349b9b5LL)), ((u64)(0x4f81afd6ec0e1411LL)), ((u64)(0x4fb61bcca7119916LL)), ((u64)(0x4feba2bfd0d5ff5bLL)), ((u64)(0x502145b7e285bf99LL)), ((u64)(0x50559725db272f7fLL)), ((u64)(0x508afcef51f0fb5fLL)), ((u64)(0x50c0de1593369d1bLL)), ((u64)(0x50f5159af8044462LL)), ((u64)(0x512a5b01b605557bLL)), ((u64)(0x516078e111c3556dLL)), ((u64)(0x5194971956342ac8LL)), ((u64)(0x51c9bcdfabc1357aLL)), ((u64)(0x5200160bcb58c16cLL)), ((u64)(0x52341b8ebe2ef1c7LL)), ((u64)(0x526922726dbaae39LL)), ((u64)(0x529f6b0f092959c7LL)), ((u64)(0x52d3a2e965b9d81dLL)), ((u64)(0x53088ba3bf284e24LL)), ((u64)(0x533eae8caef261adLL)), ((u64)(0x53732d17ed577d0cLL)), ((u64)(0x53a7f85de8ad5c4fLL)), ((u64)(0x53ddf67562d8b363LL)), ((u64)(0x5412ba095dc7701eLL)), ((u64)(0x5447688bb5394c25LL)), ((u64)(0x547d42aea2879f2eLL)), ((u64)(0x54b249ad2594c37dLL)), ((u64)(0x54e6dc186ef9f45cLL)), ((u64)(0x551c931e8ab87173LL)), ((u64)(0x5551dbf316b346e8LL)), ((u64)(0x558652efdc6018a2LL)), ((u64)(0x55bbe7abd3781ecaLL)), ((u64)(0x55f170cb642b133fLL)), ((u64)(0x5625ccfe3d35d80eLL)), ((u64)(0x565b403dcc834e12LL)), ((u64)(0x569108269fd210cbLL)), ((u64)(0x56c54a3047c694feLL)), ((u64)(0x56fa9cbc59b83a3dLL)), ((u64)(0x5730a1f5b8132466LL)), ((u64)(0x5764ca732617ed80LL)), ((u64)(0x5799fd0fef9de8e0LL)), ((u64)(0x57d03e29f5c2b18cLL)), ((u64)(0x58044db473335defLL)), ((u64)(0x583961219000356bLL)), ((u64)(0x586fb969f40042c5LL)), ((u64)(0x58a3d3e2388029bbLL)), ((u64)(0x58d8c8dac6a0342aLL)), ((u64)(0x590efb1178484135LL)), ((u64)(0x59435ceaeb2d28c1LL)), ((u64)(0x59783425a5f872f1LL)), ((u64)(0x59ae412f0f768fadLL)), ((u64)(0x59e2e8bd69aa19ccLL)), ((u64)(0x5a17a2ecc414a03fLL)), ((u64)(0x5a4d8ba7f519c84fLL)), ((u64)(0x5a827748f9301d32LL)), ((u64)(0x5ab7151b377c247eLL)), ((u64)(0x5aecda62055b2d9eLL)), ((u64)(0x5b22087d4358fc82LL)), ((u64)(0x5b568a9c942f3ba3LL)), ((u64)(0x5b8c2d43b93b0a8cLL)), ((u64)(0x5bc19c4a53c4e697LL)), ((u64)(0x5bf6035ce8b6203dLL)), ((u64)(0x5c2b843422e3a84dLL)), ((u64)(0x5c6132a095ce4930LL)), ((u64)(0x5c957f48bb41db7cLL)), ((u64)(0x5ccadf1aea12525bLL)), ((u64)(0x5d00cb70d24b7379LL)), ((u64)(0x5d34fe4d06de5057LL)), ((u64)(0x5d6a3de04895e46dLL)), ((u64)(0x5da066ac2d5daec4LL)), ((u64)(0x5dd4805738b51a75LL)), ((u64)(0x5e09a06d06e26112LL)), ((u64)(0x5e400444244d7cabLL)), ((u64)(0x5e7405552d60dbd6LL)), ((u64)(0x5ea906aa78b912ccLL)), ((u64)(0x5edf485516e7577fLL)), ((u64)(0x5f138d352e5096afLL)), ((u64)(0x5f48708279e4bc5bLL)), ((u64)(0x5f7e8ca3185deb72LL)), ((u64)(0x5fb317e5ef3ab327LL)), ((u64)(0x5fe7dddf6b095ff1LL)), ((u64)(0x601dd55745cbb7edLL)), ((u64)(0x6052a5568b9f52f4LL)), ((u64)(0x60874eac2e8727b1LL)), ((u64)(0x60bd22573a28f19dLL)), ((u64)(0x60f2357684599702LL)), ((u64)(0x6126c2d4256ffcc3LL)), ((u64)(0x615c73892ecbfbf4LL)), ((u64)(0x6191c835bd3f7d78LL)), ((u64)(0x61c63a432c8f5cd6LL)), ((u64)(0x61fbc8d3f7b3340cLL)), ((u64)(0x62315d847ad00087LL)), ((u64)(0x6265b4e5998400a9LL)), ((u64)(0x629b221effe500d4LL)), ((u64)(0x62d0f5535fef2084LL)), ((u64)(0x630532a837eae8a5LL)), ((u64)(0x633a7f5245e5a2cfLL)), ((u64)(0x63708f936baf85c1LL)), ((u64)(0x63a4b378469b6732LL)), ((u64)(0x63d9e056584240feLL)), ((u64)(0x64102c35f729689fLL)), ((u64)(0x6444374374f3c2c6LL)), ((u64)(0x647945145230b378LL)), ((u64)(0x64af965966bce056LL)), ((u64)(0x64e3bdf7e0360c36LL)), ((u64)(0x6518ad75d8438f43LL)), ((u64)(0x654ed8d34e547314LL)), ((u64)(0x6583478410f4c7ecLL)), ((u64)(0x65b819651531f9e8LL)), ((u64)(0x65ee1fbe5a7e7861LL)), ((u64)(0x6622d3d6f88f0b3dLL)), ((u64)(0x665788ccb6b2ce0cLL)), ((u64)(0x668d6affe45f818fLL)), ((u64)(0x66c262dfeebbb0f9LL)), ((u64)(0x66f6fb97ea6a9d38LL)), ((u64)(0x672cba7de5054486LL)), ((u64)(0x6761f48eaf234ad4LL)), ((u64)(0x679671b25aec1d89LL)), ((u64)(0x67cc0e1ef1a724ebLL)), ((u64)(0x680188d357087713LL)), ((u64)(0x6835eb082cca94d7LL)), ((u64)(0x686b65ca37fd3a0dLL)), ((u64)(0x68a11f9e62fe4448LL)), ((u64)(0x68d56785fbbdd55aLL)), ((u64)(0x690ac1677aad4ab1LL)), ((u64)(0x6940b8e0acac4eafLL)), ((u64)(0x6974e718d7d7625aLL)), ((u64)(0x69aa20df0dcd3af1LL)), ((u64)(0x69e0548b68a044d6LL)), ((u64)(0x6a1469ae42c8560cLL)), ((u64)(0x6a498419d37a6b8fLL)), ((u64)(0x6a7fe52048590673LL)), ((u64)(0x6ab3ef342d37a408LL)), ((u64)(0x6ae8eb0138858d0aLL)), ((u64)(0x6b1f25c186a6f04cLL)), ((u64)(0x6b537798f4285630LL)), ((u64)(0x6b88557f31326bbbLL)), ((u64)(0x6bbe6adefd7f06aaLL)), ((u64)(0x6bf302cb5e6f642aLL)), ((u64)(0x6c27c37e360b3d35LL)), ((u64)(0x6c5db45dc38e0c82LL)), ((u64)(0x6c9290ba9a38c7d1LL)), ((u64)(0x6cc734e940c6f9c6LL)), ((u64)(0x6cfd022390f8b837LL)), ((u64)(0x6d3221563a9b7323LL)), ((u64)(0x6d66a9abc9424febLL)), ((u64)(0x6d9c5416bb92e3e6LL)), ((u64)(0x6dd1b48e353bce70LL)), ((u64)(0x6e0621b1c28ac20cLL)), ((u64)(0x6e3baa1e332d728fLL)), ((u64)(0x6e714a52dffc6799LL)), ((u64)(0x6ea59ce797fb817fLL)), ((u64)(0x6edb04217dfa61dfLL)), ((u64)(0x6f10e294eebc7d2cLL)), ((u64)(0x6f451b3a2a6b9c76LL)), ((u64)(0x6f7a6208b5068394LL)), ((u64)(0x6fb07d457124123dLL)), ((u64)(0x6fe49c96cd6d16ccLL)), ((u64)(0x7019c3bc80c85c7fLL)), ((u64)(0x70501a55d07d39cfLL)), ((u64)(0x708420eb449c8843LL)), ((u64)(0x70b9292615c3aa54LL)), ((u64)(0x70ef736f9b3494e9LL)), ((u64)(0x7123a825c100dd11LL)), ((u64)(0x7158922f31411456LL)), ((u64)(0x718eb6bafd91596bLL)), ((u64)(0x71c33234de7ad7e3LL)), ((u64)(0x71f7fec216198ddcLL)), ((u64)(0x722dfe729b9ff153LL)), ((u64)(0x7262bf07a143f6d4LL)), ((u64)(0x72976ec98994f489LL)), ((u64)(0x72cd4a7bebfa31abLL)), ((u64)(0x73024e8d737c5f0bLL)), ((u64)(0x7336e230d05b76cdLL)), ((u64)(0x736c9abd04725481LL)), ((u64)(0x73a1e0b622c774d0LL)), ((u64)(0x73d658e3ab795204LL)), ((u64)(0x740bef1c9657a686LL)), ((u64)(0x74417571ddf6c814LL)), ((u64)(0x7475d2ce55747a18LL)), ((u64)(0x74ab4781ead1989eLL)), ((u64)(0x74e10cb132c2ff63LL)), ((u64)(0x75154fdd7f73bf3cLL)), ((u64)(0x754aa3d4df50af0bLL)), ((u64)(0x7580a6650b926d67LL)), ((u64)(0x75b4cffe4e7708c0LL)), ((u64)(0x75ea03fde214caf1LL)), ((u64)(0x7620427ead4cfed6LL)), ((u64)(0x7654531e58a03e8cLL)), ((u64)(0x768967e5eec84e2fLL)), ((u64)(0x76bfc1df6a7a61bbLL)), ((u64)(0x76f3d92ba28c7d15LL)), ((u64)(0x7728cf768b2f9c5aLL)), ((u64)(0x775f03542dfb8370LL)), ((u64)(0x779362149cbd3226LL)), ((u64)(0x77c83a99c3ec7eb0LL)), ((u64)(0x77fe494034e79e5cLL)), ((u64)(0x7832edc82110c2f9LL)), ((u64)(0x7867a93a2954f3b8LL)), ((u64)(0x789d9388b3aa30a5LL)), ((u64)(0x78d27c35704a5e67LL)), ((u64)(0x79071b42cc5cf601LL)), ((u64)(0x793ce2137f743382LL)), ((u64)(0x79720d4c2fa8a031LL)), ((u64)(0x79a6909f3b92c83dLL)), ((u64)(0x79dc34c70a777a4dLL)), ((u64)(0x7a11a0fc668aac70LL)), ((u64)(0x7a46093b802d578cLL)), ((u64)(0x7a7b8b8a6038ad6fLL)), ((u64)(0x7ab137367c236c65LL)), ((u64)(0x7ae585041b2c477fLL)), ((u64)(0x7b1ae64521f7595eLL)), ((u64)(0x7b50cfeb353a97dbLL)), ((u64)(0x7b8503e602893dd2LL)), ((u64)(0x7bba44df832b8d46LL)), ((u64)(0x7bf06b0bb1fb384cLL)), ((u64)(0x7c2485ce9e7a065fLL)), ((u64)(0x7c59a742461887f6LL)), ((u64)(0x7c9008896bcf54faLL)), ((u64)(0x7cc40aabc6c32a38LL)), ((u64)(0x7cf90d56b873f4c7LL)), ((u64)(0x7d2f50ac6690f1f8LL)), ((u64)(0x7d63926bc01a973bLL)), ((u64)(0x7d987706b0213d0aLL)), ((u64)(0x7dce94c85c298c4cLL)), ((u64)(0x7e031cfd3999f7b0LL)), ((u64)(0x7e37e43c8800759cLL)), ((u64)(0x7e6ddd4baa009303LL)), ((u64)(0x7ea2aa4f4a405be2LL)), ((u64)(0x7ed754e31cd072daLL)), ((u64)(0x7f0d2a1be4048f90LL)), ((u64)(0x7f423a516e82d9baLL)), ((u64)(0x7f76c8e5ca239029LL)), ((u64)(0x7fac7b1f3cac7433LL)), ((u64)(0x7fe1ccf385ebc8a0LL))}; // fixed array const static Array_fixed_u64_324 _const_strconv__neg_exp = {((u64)(0x3ff0000000000000LL)), ((u64)(0x3fb999999999999aLL)), ((u64)(0x3f847ae147ae147bLL)), ((u64)(0x3f50624dd2f1a9fcLL)), ((u64)(0x3f1a36e2eb1c432dLL)), ((u64)(0x3ee4f8b588e368f1LL)), ((u64)(0x3eb0c6f7a0b5ed8dLL)), ((u64)(0x3e7ad7f29abcaf48LL)), ((u64)(0x3e45798ee2308c3aLL)), ((u64)(0x3e112e0be826d695LL)), ((u64)(0x3ddb7cdfd9d7bdbbLL)), ((u64)(0x3da5fd7fe1796495LL)), ((u64)(0x3d719799812dea11LL)), ((u64)(0x3d3c25c268497682LL)), ((u64)(0x3d06849b86a12b9bLL)), ((u64)(0x3cd203af9ee75616LL)), ((u64)(0x3c9cd2b297d889bcLL)), ((u64)(0x3c670ef54646d497LL)), ((u64)(0x3c32725dd1d243acLL)), ((u64)(0x3bfd83c94fb6d2acLL)), ((u64)(0x3bc79ca10c924223LL)), ((u64)(0x3b92e3b40a0e9b4fLL)), ((u64)(0x3b5e392010175ee6LL)), ((u64)(0x3b282db34012b251LL)), ((u64)(0x3af357c299a88ea7LL)), ((u64)(0x3abef2d0f5da7dd9LL)), ((u64)(0x3a88c240c4aecb14LL)), ((u64)(0x3a53ce9a36f23c10LL)), ((u64)(0x3a1fb0f6be506019LL)), ((u64)(0x39e95a5efea6b347LL)), ((u64)(0x39b4484bfeebc2a0LL)), ((u64)(0x398039d665896880LL)), ((u64)(0x3949f623d5a8a733LL)), ((u64)(0x3914c4e977ba1f5cLL)), ((u64)(0x38e09d8792fb4c49LL)), ((u64)(0x38aa95a5b7f87a0fLL)), ((u64)(0x38754484932d2e72LL)), ((u64)(0x3841039d428a8b8fLL)), ((u64)(0x380b38fb9daa78e4LL)), ((u64)(0x37d5c72fb1552d83LL)), ((u64)(0x37a16c262777579cLL)), ((u64)(0x376be03d0bf225c7LL)), ((u64)(0x37364cfda3281e39LL)), ((u64)(0x3701d7314f534b61LL)), ((u64)(0x36cc8b8218854567LL)), ((u64)(0x3696d601ad376ab9LL)), ((u64)(0x366244ce242c5561LL)), ((u64)(0x362d3ae36d13bbceLL)), ((u64)(0x35f7624f8a762fd8LL)), ((u64)(0x35c2b50c6ec4f313LL)), ((u64)(0x358dee7a4ad4b81fLL)), ((u64)(0x3557f1fb6f10934cLL)), ((u64)(0x352327fc58da0f70LL)), ((u64)(0x34eea6608e29b24dLL)), ((u64)(0x34b8851a0b548ea4LL)), ((u64)(0x34839dae6f76d883LL)), ((u64)(0x344f62b0b257c0d2LL)), ((u64)(0x34191bc08eac9a41LL)), ((u64)(0x33e41633a556e1ceLL)), ((u64)(0x33b011c2eaabe7d8LL)), ((u64)(0x3379b604aaaca626LL)), ((u64)(0x3344919d5556eb52LL)), ((u64)(0x3310747ddddf22a8LL)), ((u64)(0x32da53fc9631d10dLL)), ((u64)(0x32a50ffd44f4a73dLL)), ((u64)(0x3270d9976a5d5297LL)), ((u64)(0x323af5bf109550f2LL)), ((u64)(0x32059165a6ddda5bLL)), ((u64)(0x31d1411e1f17e1e3LL)), ((u64)(0x319b9b6364f30304LL)), ((u64)(0x316615e91d8f359dLL)), ((u64)(0x3131ab20e472914aLL)), ((u64)(0x30fc45016d841baaLL)), ((u64)(0x30c69d9abe034955LL)), ((u64)(0x309217aefe690777LL)), ((u64)(0x305cf2b1970e7258LL)), ((u64)(0x3027288e1271f513LL)), ((u64)(0x2ff286d80ec190dcLL)), ((u64)(0x2fbda48ce468e7c7LL)), ((u64)(0x2f87b6d71d20b96cLL)), ((u64)(0x2f52f8ac174d6123LL)), ((u64)(0x2f1e5aacf2156838LL)), ((u64)(0x2ee8488a5b445360LL)), ((u64)(0x2eb36d3b7c36a91aLL)), ((u64)(0x2e7f152bf9f10e90LL)), ((u64)(0x2e48ddbcc7f40ba6LL)), ((u64)(0x2e13e497065cd61fLL)), ((u64)(0x2ddfd424d6faf031LL)), ((u64)(0x2da97683df2f268dLL)), ((u64)(0x2d745ecfe5bf520bLL)), ((u64)(0x2d404bd984990e6fLL)), ((u64)(0x2d0a12f5a0f4e3e5LL)), ((u64)(0x2cd4dbf7b3f71cb7LL)), ((u64)(0x2ca0aff95cc5b092LL)), ((u64)(0x2c6ab328946f80eaLL)), ((u64)(0x2c355c2076bf9a55LL)), ((u64)(0x2c0116805effaeaaLL)), ((u64)(0x2bcb5733cb32b111LL)), ((u64)(0x2b95df5ca28ef40dLL)), ((u64)(0x2b617f7d4ed8c33eLL)), ((u64)(0x2b2bff2ee48e0530LL)), ((u64)(0x2af665bf1d3e6a8dLL)), ((u64)(0x2ac1eaff4a98553dLL)), ((u64)(0x2a8cab3210f3bb95LL)), ((u64)(0x2a56ef5b40c2fc77LL)), ((u64)(0x2a225915cd68c9f9LL)), ((u64)(0x29ed5b561574765bLL)), ((u64)(0x29b77c44ddf6c516LL)), ((u64)(0x2982c9d0b1923745LL)), ((u64)(0x294e0fb44f50586eLL)), ((u64)(0x29180c903f7379f2LL)), ((u64)(0x28e33d4032c2c7f5LL)), ((u64)(0x28aec866b79e0cbaLL)), ((u64)(0x2878a0522c7e7095LL)), ((u64)(0x2843b374f06526deLL)), ((u64)(0x280f8587e7083e30LL)), ((u64)(0x27d9379fec069826LL)), ((u64)(0x27a42c7ff0054685LL)), ((u64)(0x277023998cd10537LL)), ((u64)(0x2739d28f47b4d525LL)), ((u64)(0x2704a8729fc3ddb7LL)), ((u64)(0x26d086c219697e2cLL)), ((u64)(0x269a71368f0f3047LL)), ((u64)(0x2665275ed8d8f36cLL)), ((u64)(0x2630ec4be0ad8f89LL)), ((u64)(0x25fb13ac9aaf4c0fLL)), ((u64)(0x25c5a956e225d672LL)), ((u64)(0x2591544581b7dec2LL)), ((u64)(0x255bba08cf8c979dLL)), ((u64)(0x25262e6d72d6dfb0LL)), ((u64)(0x24f1bebdf578b2f4LL)), ((u64)(0x24bc6463225ab7ecLL)), ((u64)(0x2486b6b5b5155ff0LL)), ((u64)(0x24522bc490dde65aLL)), ((u64)(0x241d12d41afca3c3LL)), ((u64)(0x23e7424348ca1c9cLL)), ((u64)(0x23b29b69070816e3LL)), ((u64)(0x237dc574d80cf16bLL)), ((u64)(0x2347d12a4670c123LL)), ((u64)(0x23130dbb6b8d674fLL)), ((u64)(0x22de7c5f127bd87eLL)), ((u64)(0x22a8637f41fcad32LL)), ((u64)(0x227382cc34ca2428LL)), ((u64)(0x223f37ad21436d0cLL)), ((u64)(0x2208f9574dcf8a70LL)), ((u64)(0x21d3faac3e3fa1f3LL)), ((u64)(0x219ff779fd329cb9LL)), ((u64)(0x216992c7fdc216faLL)), ((u64)(0x2134756ccb01abfbLL)), ((u64)(0x21005df0a267bcc9LL)), ((u64)(0x20ca2fe76a3f9475LL)), ((u64)(0x2094f31f8832dd2aLL)), ((u64)(0x2060c27fa028b0efLL)), ((u64)(0x202ad0cc33744e4bLL)), ((u64)(0x1ff573d68f903ea2LL)), ((u64)(0x1fc1297872d9cbb5LL)), ((u64)(0x1f8b758d848fac55LL)), ((u64)(0x1f55f7a46a0c89ddLL)), ((u64)(0x1f2192e9ee706e4bLL)), ((u64)(0x1eec1e43171a4a11LL)), ((u64)(0x1eb67e9c127b6e74LL)), ((u64)(0x1e81fee341fc585dLL)), ((u64)(0x1e4ccb0536608d61LL)), ((u64)(0x1e1708d0f84d3de7LL)), ((u64)(0x1de26d73f9d764b9LL)), ((u64)(0x1dad7becc2f23ac2LL)), ((u64)(0x1d779657025b6235LL)), ((u64)(0x1d42deac01e2b4f7LL)), ((u64)(0x1d0e3113363787f2LL)), ((u64)(0x1cd8274291c6065bLL)), ((u64)(0x1ca3529ba7d19eafLL)), ((u64)(0x1c6eea92a61c3118LL)), ((u64)(0x1c38bba884e35a7aLL)), ((u64)(0x1c03c9539d82aec8LL)), ((u64)(0x1bcfa885c8d117a6LL)), ((u64)(0x1b99539e3a40dfb8LL)), ((u64)(0x1b6442e4fb671960LL)), ((u64)(0x1b303583fc527ab3LL)), ((u64)(0x1af9ef3993b72ab8LL)), ((u64)(0x1ac4bf6142f8eefaLL)), ((u64)(0x1a90991a9bfa58c8LL)), ((u64)(0x1a5a8e90f9908e0dLL)), ((u64)(0x1a253eda614071a4LL)), ((u64)(0x19f0ff151a99f483LL)), ((u64)(0x19bb31bb5dc320d2LL)), ((u64)(0x1985c162b168e70eLL)), ((u64)(0x1951678227871f3eLL)), ((u64)(0x191bd8d03f3e9864LL)), ((u64)(0x18e6470cff6546b6LL)), ((u64)(0x18b1d270cc51055fLL)), ((u64)(0x187c83e7ad4e6efeLL)), ((u64)(0x1846cfec8aa52598LL)), ((u64)(0x18123ff06eea847aLL)), ((u64)(0x17dd331a4b10d3f6LL)), ((u64)(0x17a75c1508da432bLL)), ((u64)(0x1772b010d3e1cf56LL)), ((u64)(0x173de6815302e556LL)), ((u64)(0x1707eb9aa8cf1ddeLL)), ((u64)(0x16d322e220a5b17eLL)), ((u64)(0x169e9e369aa2b597LL)), ((u64)(0x16687e92154ef7acLL)), ((u64)(0x16339874ddd8c623LL)), ((u64)(0x15ff5a549627a36cLL)), ((u64)(0x15c91510781fb5f0LL)), ((u64)(0x159410d9f9b2f7f3LL)), ((u64)(0x15600d7b2e28c65cLL)), ((u64)(0x1529af2b7d0e0a2dLL)), ((u64)(0x14f48c22ca71a1bdLL)), ((u64)(0x14c0701bd527b498LL)), ((u64)(0x148a4cf9550c5426LL)), ((u64)(0x14550a6110d6a9b8LL)), ((u64)(0x1420d51a73deee2dLL)), ((u64)(0x13eaee90b964b047LL)), ((u64)(0x13b58ba6fab6f36cLL)), ((u64)(0x13813c85955f2923LL)), ((u64)(0x134b9408eefea839LL)), ((u64)(0x1316100725988694LL)), ((u64)(0x12e1a66c1e139eddLL)), ((u64)(0x12ac3d79c9b8fe2eLL)), ((u64)(0x12769794a160cb58LL)), ((u64)(0x124212dd4de70913LL)), ((u64)(0x120ceafbafd80e85LL)), ((u64)(0x11d72262f3133ed1LL)), ((u64)(0x11a281e8c275cbdaLL)), ((u64)(0x116d9ca79d89462aLL)), ((u64)(0x1137b08617a104eeLL)), ((u64)(0x1102f39e794d9d8bLL)), ((u64)(0x10ce5297287c2f45LL)), ((u64)(0x1098421286c9bf6bLL)), ((u64)(0x1063680ed23aff89LL)), ((u64)(0x102f0ce4839198dbLL)), ((u64)(0x0ff8d71d360e13e2LL)), ((u64)(0x0fc3df4a91a4dcb5LL)), ((u64)(0x0f8fcbaa82a16121LL)), ((u64)(0x0f596fbb9bb44db4LL)), ((u64)(0x0f245962e2f6a490LL)), ((u64)(0x0ef047824f2bb6daLL)), ((u64)(0x0eba0c03b1df8af6LL)), ((u64)(0x0e84d6695b193bf8LL)), ((u64)(0x0e50ab877c142ffaLL)), ((u64)(0x0e1aac0bf9b9e65cLL)), ((u64)(0x0de5566ffafb1eb0LL)), ((u64)(0x0db111f32f2f4bc0LL)), ((u64)(0x0d7b4feb7eb212cdLL)), ((u64)(0x0d45d98932280f0aLL)), ((u64)(0x0d117ad428200c08LL)), ((u64)(0x0cdbf7b9d9cce00dLL)), ((u64)(0x0ca65fc7e170b33eLL)), ((u64)(0x0c71e6398126f5cbLL)), ((u64)(0x0c3ca38f350b22dfLL)), ((u64)(0x0c06e93f5da2824cLL)), ((u64)(0x0bd25432b14ecea3LL)), ((u64)(0x0b9d53844ee47dd1LL)), ((u64)(0x0b677603725064a8LL)), ((u64)(0x0b32c4cf8ea6b6ecLL)), ((u64)(0x0afe07b27dd78b14LL)), ((u64)(0x0ac8062864ac6f43LL)), ((u64)(0x0a9338205089f29cLL)), ((u64)(0x0a5ec033b40fea93LL)), ((u64)(0x0a2899c2f6732210LL)), ((u64)(0x09f3ae3591f5b4d9LL)), ((u64)(0x09bf7d228322baf5LL)), ((u64)(0x098930e868e89591LL)), ((u64)(0x0954272053ed4474LL)), ((u64)(0x09201f4d0ff10390LL)), ((u64)(0x08e9cbae7fe805b3LL)), ((u64)(0x08b4a2f1ffecd15cLL)), ((u64)(0x0880825b3323dab0LL)), ((u64)(0x084a6a2b85062ab3LL)), ((u64)(0x081521bc6a6b555cLL)), ((u64)(0x07e0e7c9eebc444aLL)), ((u64)(0x07ab0c764ac6d3a9LL)), ((u64)(0x0775a391d56bdc87LL)), ((u64)(0x07414fa7ddefe3a0LL)), ((u64)(0x070bb2a62fe638ffLL)), ((u64)(0x06d62884f31e93ffLL)), ((u64)(0x06a1ba03f5b21000LL)), ((u64)(0x066c5cd322b67fffLL)), ((u64)(0x0636b0a8e891ffffLL)), ((u64)(0x060226ed86db3333LL)), ((u64)(0x05cd0b15a491eb84LL)), ((u64)(0x05973c115074bc6aLL)), ((u64)(0x05629674405d6388LL)), ((u64)(0x052dbd86cd6238d9LL)), ((u64)(0x04f7cad23de82d7bLL)), ((u64)(0x04c308a831868ac9LL)), ((u64)(0x048e74404f3daadbLL)), ((u64)(0x04585d003f6488afLL)), ((u64)(0x04237d99cc506d59LL)), ((u64)(0x03ef2f5c7a1a488eLL)), ((u64)(0x03b8f2b061aea072LL)), ((u64)(0x0383f559e7bee6c1LL)), ((u64)(0x034feef63f97d79cLL)), ((u64)(0x03198bf832dfdfb0LL)), ((u64)(0x02e46ff9c24cb2f3LL)), ((u64)(0x02b059949b708f29LL)), ((u64)(0x027a28edc580e50eLL)), ((u64)(0x0244ed8b04671da5LL)), ((u64)(0x0210be08d0527e1dLL)), ((u64)(0x01dac9a7b3b7302fLL)), ((u64)(0x01a56e1fc2f8f359LL)), ((u64)(0x017124e63593f5e1LL)), ((u64)(0x013b6e3d22865634LL)), ((u64)(0x0105f1ca820511c3LL)), ((u64)(0x00d18e3b9b374169LL)), ((u64)(0x009c16c5c5253575LL)), ((u64)(0x0066789e3750f791LL)), ((u64)(0x0031fa182c40c60dLL)), ((u64)(0x000730d67819e8d2LL)), ((u64)(0x0000b8157268fdafLL)), ((u64)(0x000012688b70e62bLL)), ((u64)(0x000001d74124e3d1LL)), ((u64)(0x0000002f201d49fbLL)), ((u64)(0x00000004b6695433LL)), ((u64)(0x0000000078a42205)), ((u64)(0x000000000c1069cd)), ((u64)(0x000000000134d761)), ((u64)(0x00000000001ee257)), ((u64)(0x00000000000316a2)), ((u64)(0x0000000000004f10)), ((u64)(0x00000000000007e8)), ((u64)(0x00000000000000ca)), ((u64)(0x0000000000000014)), ((u64)(0x0000000000000002))}; // fixed array const static i64 _const_strconv__i64_min_int32; // inited later static i64 _const_strconv__i64_max_int32; // inited later static Array_fixed_u32_10 _const_strconv__ten_pow_table_32 = {((u32)(1)), ((u32)(10)), ((u32)(100)), ((u32)(1000)), ((u32)(10000)), ((u32)(100000)), ((u32)(1000000)), ((u32)(10000000)), ((u32)(100000000)), ((u32)(1000000000))}; // fixed array const static const u32 _const_strconv__mantbits32 = 23; // precomputed2 static const u32 _const_strconv__expbits32 = 8; // precomputed2 static Array_fixed_u64_20 _const_strconv__ten_pow_table_64 = {((u64)(1)), ((u64)(10)), ((u64)(100)), ((u64)(1000)), ((u64)(10000)), ((u64)(100000)), ((u64)(1000000)), ((u64)(10000000)), ((u64)(100000000)), ((u64)(1000000000)), ((u64)(10000000000LL)), ((u64)(100000000000LL)), ((u64)(1000000000000LL)), ((u64)(10000000000000LL)), ((u64)(100000000000000LL)), ((u64)(1000000000000000LL)), ((u64)(10000000000000000LL)), ((u64)(100000000000000000LL)), ((u64)(1000000000000000000LL)), ((u64)(10000000000000000000ULL))}; // fixed array const static const u32 _const_strconv__mantbits64 = 52; // precomputed2 static const u32 _const_strconv__expbits64 = 11; // precomputed2 static Array_fixed_f64_36 _const_strconv__dec_round = {((f64)(0.5)), 0.05, 0.005, 0.0005, 0.00005, 0.000005, 0.0000005, 0.00000005, 0.000000005, 0.0000000005, 0.00000000005, 0.000000000005, 0.0000000000005, 0.00000000000005, 0.000000000000005, 0.0000000000000005, 0.00000000000000005, 0.000000000000000005, 0.0000000000000000005, 0.00000000000000000005, 0.000000000000000000005, 0.0000000000000000000005, 0.00000000000000000000005, 0.000000000000000000000005, 0.0000000000000000000000005, 0.00000000000000000000000005, 0.000000000000000000000000005, 0.0000000000000000000000000005, 0.00000000000000000000000000005, 0.000000000000000000000000000005, 0.0000000000000000000000000000005, 0.00000000000000000000000000000005, 0.000000000000000000000000000000005, 0.0000000000000000000000000000000005, 0.00000000000000000000000000000000005, 0.000000000000000000000000000000000005}; // fixed array const static Array_fixed_u64_47 _const_strconv__pow5_split_32 = {((u64)(1152921504606846976LL)), ((u64)(1441151880758558720LL)), ((u64)(1801439850948198400LL)), ((u64)(2251799813685248000LL)), ((u64)(1407374883553280000LL)), ((u64)(1759218604441600000LL)), ((u64)(2199023255552000000LL)), ((u64)(1374389534720000000LL)), ((u64)(1717986918400000000LL)), ((u64)(2147483648000000000LL)), ((u64)(1342177280000000000LL)), ((u64)(1677721600000000000LL)), ((u64)(2097152000000000000LL)), ((u64)(1310720000000000000LL)), ((u64)(1638400000000000000LL)), ((u64)(2048000000000000000LL)), ((u64)(1280000000000000000LL)), ((u64)(1600000000000000000LL)), ((u64)(2000000000000000000LL)), ((u64)(1250000000000000000LL)), ((u64)(1562500000000000000LL)), ((u64)(1953125000000000000LL)), ((u64)(1220703125000000000LL)), ((u64)(1525878906250000000LL)), ((u64)(1907348632812500000LL)), ((u64)(1192092895507812500LL)), ((u64)(1490116119384765625LL)), ((u64)(1862645149230957031LL)), ((u64)(1164153218269348144LL)), ((u64)(1455191522836685180LL)), ((u64)(1818989403545856475LL)), ((u64)(2273736754432320594LL)), ((u64)(1421085471520200371LL)), ((u64)(1776356839400250464LL)), ((u64)(2220446049250313080LL)), ((u64)(1387778780781445675LL)), ((u64)(1734723475976807094LL)), ((u64)(2168404344971008868LL)), ((u64)(1355252715606880542LL)), ((u64)(1694065894508600678LL)), ((u64)(2117582368135750847LL)), ((u64)(1323488980084844279LL)), ((u64)(1654361225106055349LL)), ((u64)(2067951531382569187LL)), ((u64)(1292469707114105741LL)), ((u64)(1615587133892632177LL)), ((u64)(2019483917365790221LL))}; // fixed array const static Array_fixed_u64_31 _const_strconv__pow5_inv_split_32 = {((u64)(576460752303423489LL)), ((u64)(461168601842738791LL)), ((u64)(368934881474191033LL)), ((u64)(295147905179352826LL)), ((u64)(472236648286964522LL)), ((u64)(377789318629571618LL)), ((u64)(302231454903657294LL)), ((u64)(483570327845851670LL)), ((u64)(386856262276681336LL)), ((u64)(309485009821345069LL)), ((u64)(495176015714152110LL)), ((u64)(396140812571321688LL)), ((u64)(316912650057057351LL)), ((u64)(507060240091291761LL)), ((u64)(405648192073033409LL)), ((u64)(324518553658426727LL)), ((u64)(519229685853482763LL)), ((u64)(415383748682786211LL)), ((u64)(332306998946228969LL)), ((u64)(531691198313966350LL)), ((u64)(425352958651173080LL)), ((u64)(340282366920938464LL)), ((u64)(544451787073501542LL)), ((u64)(435561429658801234LL)), ((u64)(348449143727040987LL)), ((u64)(557518629963265579LL)), ((u64)(446014903970612463LL)), ((u64)(356811923176489971LL)), ((u64)(570899077082383953LL)), ((u64)(456719261665907162LL)), ((u64)(365375409332725730LL))}; // fixed array const static Array_fixed_u64_652 _const_strconv__pow5_split_64_x = {((u64)(0x0000000000000000)), ((u64)(0x0100000000000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x0140000000000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x0190000000000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x01f4000000000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x0138800000000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x0186a00000000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x01e8480000000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x01312d0000000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x017d784000000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x01dcd65000000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x012a05f200000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x0174876e80000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x01d1a94a20000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x012309ce54000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x016bcc41e9000000LL)), ((u64)(0x0000000000000000)), ((u64)(0x01c6bf5263400000LL)), ((u64)(0x0000000000000000)), ((u64)(0x011c37937e080000LL)), ((u64)(0x0000000000000000)), ((u64)(0x016345785d8a0000LL)), ((u64)(0x0000000000000000)), ((u64)(0x01bc16d674ec8000LL)), ((u64)(0x0000000000000000)), ((u64)(0x01158e460913d000LL)), ((u64)(0x0000000000000000)), ((u64)(0x015af1d78b58c400LL)), ((u64)(0x0000000000000000)), ((u64)(0x01b1ae4d6e2ef500LL)), ((u64)(0x0000000000000000)), ((u64)(0x010f0cf064dd5920LL)), ((u64)(0x0000000000000000)), ((u64)(0x0152d02c7e14af68LL)), ((u64)(0x0000000000000000)), ((u64)(0x01a784379d99db42LL)), ((u64)(0x4000000000000000LL)), ((u64)(0x0108b2a2c2802909LL)), ((u64)(0x9000000000000000ULL)), ((u64)(0x014adf4b7320334bLL)), ((u64)(0x7400000000000000LL)), ((u64)(0x019d971e4fe8401eLL)), ((u64)(0x0880000000000000LL)), ((u64)(0x01027e72f1f12813LL)), ((u64)(0xcaa0000000000000ULL)), ((u64)(0x01431e0fae6d7217LL)), ((u64)(0xbd48000000000000ULL)), ((u64)(0x0193e5939a08ce9dLL)), ((u64)(0x2c9a000000000000LL)), ((u64)(0x01f8def8808b0245LL)), ((u64)(0x3be0400000000000LL)), ((u64)(0x013b8b5b5056e16bLL)), ((u64)(0x0ad8500000000000LL)), ((u64)(0x018a6e32246c99c6LL)), ((u64)(0x8d8e640000000000ULL)), ((u64)(0x01ed09bead87c037LL)), ((u64)(0xb878fe8000000000ULL)), ((u64)(0x013426172c74d822LL)), ((u64)(0x66973e2000000000LL)), ((u64)(0x01812f9cf7920e2bLL)), ((u64)(0x403d0da800000000LL)), ((u64)(0x01e17b84357691b6LL)), ((u64)(0xe826288900000000ULL)), ((u64)(0x012ced32a16a1b11LL)), ((u64)(0x622fb2ab40000000LL)), ((u64)(0x0178287f49c4a1d6LL)), ((u64)(0xfabb9f5610000000ULL)), ((u64)(0x01d6329f1c35ca4bLL)), ((u64)(0x7cb54395ca000000LL)), ((u64)(0x0125dfa371a19e6fLL)), ((u64)(0x5be2947b3c800000LL)), ((u64)(0x016f578c4e0a060bLL)), ((u64)(0x32db399a0ba00000LL)), ((u64)(0x01cb2d6f618c878eLL)), ((u64)(0xdfc9040047440000ULL)), ((u64)(0x011efc659cf7d4b8LL)), ((u64)(0x17bb450059150000LL)), ((u64)(0x0166bb7f0435c9e7LL)), ((u64)(0xddaa16406f5a4000ULL)), ((u64)(0x01c06a5ec5433c60LL)), ((u64)(0x8a8a4de845986800ULL)), ((u64)(0x0118427b3b4a05bcLL)), ((u64)(0xad2ce16256fe8200ULL)), ((u64)(0x015e531a0a1c872bLL)), ((u64)(0x987819baecbe2280ULL)), ((u64)(0x01b5e7e08ca3a8f6LL)), ((u64)(0x1f4b1014d3f6d590LL)), ((u64)(0x0111b0ec57e6499aLL)), ((u64)(0xa71dd41a08f48af4ULL)), ((u64)(0x01561d276ddfdc00LL)), ((u64)(0xd0e549208b31adb1ULL)), ((u64)(0x01aba4714957d300LL)), ((u64)(0x828f4db456ff0c8eULL)), ((u64)(0x010b46c6cdd6e3e0LL)), ((u64)(0xa33321216cbecfb2ULL)), ((u64)(0x014e1878814c9cd8LL)), ((u64)(0xcbffe969c7ee839eULL)), ((u64)(0x01a19e96a19fc40eLL)), ((u64)(0x3f7ff1e21cf51243LL)), ((u64)(0x0105031e2503da89LL)), ((u64)(0x8f5fee5aa43256d4ULL)), ((u64)(0x014643e5ae44d12bLL)), ((u64)(0x7337e9f14d3eec89LL)), ((u64)(0x0197d4df19d60576LL)), ((u64)(0x1005e46da08ea7abLL)), ((u64)(0x01fdca16e04b86d4LL)), ((u64)(0x8a03aec4845928cbULL)), ((u64)(0x013e9e4e4c2f3444LL)), ((u64)(0xac849a75a56f72fdULL)), ((u64)(0x018e45e1df3b0155LL)), ((u64)(0x17a5c1130ecb4fbdLL)), ((u64)(0x01f1d75a5709c1abLL)), ((u64)(0xeec798abe93f11d6ULL)), ((u64)(0x013726987666190aLL)), ((u64)(0xaa797ed6e38ed64bULL)), ((u64)(0x0184f03e93ff9f4dLL)), ((u64)(0x1517de8c9c728bdeLL)), ((u64)(0x01e62c4e38ff8721LL)), ((u64)(0xad2eeb17e1c7976bULL)), ((u64)(0x012fdbb0e39fb474LL)), ((u64)(0xd87aa5ddda397d46ULL)), ((u64)(0x017bd29d1c87a191LL)), ((u64)(0x4e994f5550c7dc97LL)), ((u64)(0x01dac74463a989f6LL)), ((u64)(0xf11fd195527ce9deULL)), ((u64)(0x0128bc8abe49f639LL)), ((u64)(0x6d67c5faa71c2456LL)), ((u64)(0x0172ebad6ddc73c8LL)), ((u64)(0x88c1b77950e32d6cULL)), ((u64)(0x01cfa698c95390baLL)), ((u64)(0x957912abd28dfc63ULL)), ((u64)(0x0121c81f7dd43a74LL)), ((u64)(0xbad75756c7317b7cULL)), ((u64)(0x016a3a275d494911LL)), ((u64)(0x298d2d2c78fdda5bLL)), ((u64)(0x01c4c8b1349b9b56LL)), ((u64)(0xd9f83c3bcb9ea879ULL)), ((u64)(0x011afd6ec0e14115LL)), ((u64)(0x50764b4abe865297LL)), ((u64)(0x0161bcca7119915bLL)), ((u64)(0x2493de1d6e27e73dLL)), ((u64)(0x01ba2bfd0d5ff5b2LL)), ((u64)(0x56dc6ad264d8f086LL)), ((u64)(0x01145b7e285bf98fLL)), ((u64)(0x2c938586fe0f2ca8LL)), ((u64)(0x0159725db272f7f3LL)), ((u64)(0xf7b866e8bd92f7d2ULL)), ((u64)(0x01afcef51f0fb5efLL)), ((u64)(0xfad34051767bdae3ULL)), ((u64)(0x010de1593369d1b5LL)), ((u64)(0x79881065d41ad19cLL)), ((u64)(0x015159af80444623LL)), ((u64)(0x57ea147f49218603LL)), ((u64)(0x01a5b01b605557acLL)), ((u64)(0xb6f24ccf8db4f3c1ULL)), ((u64)(0x01078e111c3556cbLL)), ((u64)(0xa4aee003712230b2ULL)), ((u64)(0x014971956342ac7eLL)), ((u64)(0x4dda98044d6abcdfLL)), ((u64)(0x019bcdfabc13579eLL)), ((u64)(0xf0a89f02b062b60bULL)), ((u64)(0x010160bcb58c16c2LL)), ((u64)(0xacd2c6c35c7b638eULL)), ((u64)(0x0141b8ebe2ef1c73LL)), ((u64)(0x98077874339a3c71ULL)), ((u64)(0x01922726dbaae390LL)), ((u64)(0xbe0956914080cb8eULL)), ((u64)(0x01f6b0f092959c74LL)), ((u64)(0xf6c5d61ac8507f38ULL)), ((u64)(0x013a2e965b9d81c8LL)), ((u64)(0x34774ba17a649f07LL)), ((u64)(0x0188ba3bf284e23bLL)), ((u64)(0x01951e89d8fdc6c8LL)), ((u64)(0x01eae8caef261acaLL)), ((u64)(0x40fd3316279e9c3dLL)), ((u64)(0x0132d17ed577d0beLL)), ((u64)(0xd13c7fdbb186434cULL)), ((u64)(0x017f85de8ad5c4edLL)), ((u64)(0x458b9fd29de7d420LL)), ((u64)(0x01df67562d8b3629LL)), ((u64)(0xcb7743e3a2b0e494ULL)), ((u64)(0x012ba095dc7701d9LL)), ((u64)(0x3e5514dc8b5d1db9LL)), ((u64)(0x017688bb5394c250LL)), ((u64)(0x4dea5a13ae346527LL)), ((u64)(0x01d42aea2879f2e4LL)), ((u64)(0xb0b2784c4ce0bf38ULL)), ((u64)(0x01249ad2594c37ceLL)), ((u64)(0x5cdf165f6018ef06LL)), ((u64)(0x016dc186ef9f45c2LL)), ((u64)(0xf416dbf7381f2ac8ULL)), ((u64)(0x01c931e8ab871732LL)), ((u64)(0xd88e497a83137abdULL)), ((u64)(0x011dbf316b346e7fLL)), ((u64)(0xceb1dbd923d8596cULL)), ((u64)(0x01652efdc6018a1fLL)), ((u64)(0xc25e52cf6cce6fc7ULL)), ((u64)(0x01be7abd3781eca7LL)), ((u64)(0xd97af3c1a40105dcULL)), ((u64)(0x01170cb642b133e8LL)), ((u64)(0x0fd9b0b20d014754LL)), ((u64)(0x015ccfe3d35d80e3LL)), ((u64)(0xd3d01cde90419929ULL)), ((u64)(0x01b403dcc834e11bLL)), ((u64)(0x6462120b1a28ffb9LL)), ((u64)(0x01108269fd210cb1LL)), ((u64)(0xbd7a968de0b33fa8ULL)), ((u64)(0x0154a3047c694fddLL)), ((u64)(0x2cd93c3158e00f92LL)), ((u64)(0x01a9cbc59b83a3d5LL)), ((u64)(0x3c07c59ed78c09bbLL)), ((u64)(0x010a1f5b81324665LL)), ((u64)(0x8b09b7068d6f0c2aULL)), ((u64)(0x014ca732617ed7feLL)), ((u64)(0x2dcc24c830cacf34LL)), ((u64)(0x019fd0fef9de8dfeLL)), ((u64)(0xdc9f96fd1e7ec180ULL)), ((u64)(0x0103e29f5c2b18beLL)), ((u64)(0x93c77cbc661e71e1ULL)), ((u64)(0x0144db473335deeeLL)), ((u64)(0x38b95beb7fa60e59LL)), ((u64)(0x01961219000356aaLL)), ((u64)(0xc6e7b2e65f8f91efULL)), ((u64)(0x01fb969f40042c54LL)), ((u64)(0xfc50cfcffbb9bb35ULL)), ((u64)(0x013d3e2388029bb4LL)), ((u64)(0x3b6503c3faa82a03LL)), ((u64)(0x018c8dac6a0342a2LL)), ((u64)(0xca3e44b4f9523484ULL)), ((u64)(0x01efb1178484134aLL)), ((u64)(0xbe66eaf11bd360d2ULL)), ((u64)(0x0135ceaeb2d28c0eLL)), ((u64)(0x6e00a5ad62c83907LL)), ((u64)(0x0183425a5f872f12LL)), ((u64)(0x0980cf18bb7a4749LL)), ((u64)(0x01e412f0f768fad7LL)), ((u64)(0x65f0816f752c6c8dLL)), ((u64)(0x012e8bd69aa19cc6LL)), ((u64)(0xff6ca1cb527787b1ULL)), ((u64)(0x017a2ecc414a03f7LL)), ((u64)(0xff47ca3e2715699dULL)), ((u64)(0x01d8ba7f519c84f5LL)), ((u64)(0xbf8cde66d86d6202ULL)), ((u64)(0x0127748f9301d319LL)), ((u64)(0x2f7016008e88ba83LL)), ((u64)(0x017151b377c247e0LL)), ((u64)(0x3b4c1b80b22ae923LL)), ((u64)(0x01cda62055b2d9d8LL)), ((u64)(0x250f91306f5ad1b6LL)), ((u64)(0x012087d4358fc827LL)), ((u64)(0xee53757c8b318623ULL)), ((u64)(0x0168a9c942f3ba30LL)), ((u64)(0x29e852dbadfde7acLL)), ((u64)(0x01c2d43b93b0a8bdLL)), ((u64)(0x3a3133c94cbeb0ccLL)), ((u64)(0x0119c4a53c4e6976LL)), ((u64)(0xc8bd80bb9fee5cffULL)), ((u64)(0x016035ce8b6203d3LL)), ((u64)(0xbaece0ea87e9f43eULL)), ((u64)(0x01b843422e3a84c8LL)), ((u64)(0x74d40c9294f238a7LL)), ((u64)(0x01132a095ce492fdLL)), ((u64)(0xd2090fb73a2ec6d1ULL)), ((u64)(0x0157f48bb41db7bcLL)), ((u64)(0x068b53a508ba7885LL)), ((u64)(0x01adf1aea12525acLL)), ((u64)(0x8417144725748b53ULL)), ((u64)(0x010cb70d24b7378bLL)), ((u64)(0x651cd958eed1ae28LL)), ((u64)(0x014fe4d06de5056eLL)), ((u64)(0xfe640faf2a8619b2ULL)), ((u64)(0x01a3de04895e46c9LL)), ((u64)(0x3efe89cd7a93d00fLL)), ((u64)(0x01066ac2d5daec3eLL)), ((u64)(0xcebe2c40d938c413ULL)), ((u64)(0x014805738b51a74dLL)), ((u64)(0x426db7510f86f518LL)), ((u64)(0x019a06d06e261121LL)), ((u64)(0xc9849292a9b4592fULL)), ((u64)(0x0100444244d7cab4LL)), ((u64)(0xfbe5b73754216f7aULL)), ((u64)(0x01405552d60dbd61LL)), ((u64)(0x7adf25052929cb59LL)), ((u64)(0x01906aa78b912cbaLL)), ((u64)(0x1996ee4673743e2fLL)), ((u64)(0x01f485516e7577e9LL)), ((u64)(0xaffe54ec0828a6ddULL)), ((u64)(0x0138d352e5096af1LL)), ((u64)(0x1bfdea270a32d095LL)), ((u64)(0x018708279e4bc5aeLL)), ((u64)(0xa2fd64b0ccbf84baULL)), ((u64)(0x01e8ca3185deb719LL)), ((u64)(0x05de5eee7ff7b2f4LL)), ((u64)(0x01317e5ef3ab3270LL)), ((u64)(0x0755f6aa1ff59fb1LL)), ((u64)(0x017dddf6b095ff0cLL)), ((u64)(0x092b7454a7f3079eLL)), ((u64)(0x01dd55745cbb7ecfLL)), ((u64)(0x65bb28b4e8f7e4c3LL)), ((u64)(0x012a5568b9f52f41LL)), ((u64)(0xbf29f2e22335ddf3ULL)), ((u64)(0x0174eac2e8727b11LL)), ((u64)(0x2ef46f9aac035570LL)), ((u64)(0x01d22573a28f19d6LL)), ((u64)(0xdd58c5c0ab821566ULL)), ((u64)(0x0123576845997025LL)), ((u64)(0x54aef730d6629ac0LL)), ((u64)(0x016c2d4256ffcc2fLL)), ((u64)(0x29dab4fd0bfb4170LL)), ((u64)(0x01c73892ecbfbf3bLL)), ((u64)(0xfa28b11e277d08e6ULL)), ((u64)(0x011c835bd3f7d784LL)), ((u64)(0x38b2dd65b15c4b1fLL)), ((u64)(0x0163a432c8f5cd66LL)), ((u64)(0xc6df94bf1db35de7ULL)), ((u64)(0x01bc8d3f7b3340bfLL)), ((u64)(0xdc4bbcf772901ab0ULL)), ((u64)(0x0115d847ad000877LL)), ((u64)(0xd35eac354f34215cULL)), ((u64)(0x015b4e5998400a95LL)), ((u64)(0x48365742a30129b4LL)), ((u64)(0x01b221effe500d3bLL)), ((u64)(0x0d21f689a5e0ba10LL)), ((u64)(0x010f5535fef20845LL)), ((u64)(0x506a742c0f58e894LL)), ((u64)(0x01532a837eae8a56LL)), ((u64)(0xe4851137132f22b9ULL)), ((u64)(0x01a7f5245e5a2cebLL)), ((u64)(0x6ed32ac26bfd75b4LL)), ((u64)(0x0108f936baf85c13LL)), ((u64)(0x4a87f57306fcd321LL)), ((u64)(0x014b378469b67318LL)), ((u64)(0x5d29f2cfc8bc07e9LL)), ((u64)(0x019e056584240fdeLL)), ((u64)(0xfa3a37c1dd7584f1ULL)), ((u64)(0x0102c35f729689eaLL)), ((u64)(0xb8c8c5b254d2e62eULL)), ((u64)(0x014374374f3c2c65LL)), ((u64)(0x26faf71eea079fb9LL)), ((u64)(0x01945145230b377fLL)), ((u64)(0xf0b9b4e6a48987a8ULL)), ((u64)(0x01f965966bce055eLL)), ((u64)(0x5674111026d5f4c9LL)), ((u64)(0x013bdf7e0360c35bLL)), ((u64)(0x2c111554308b71fbLL)), ((u64)(0x018ad75d8438f432LL)), ((u64)(0xb7155aa93cae4e7aULL)), ((u64)(0x01ed8d34e547313eLL)), ((u64)(0x326d58a9c5ecf10cLL)), ((u64)(0x013478410f4c7ec7LL)), ((u64)(0xff08aed437682d4fULL)), ((u64)(0x01819651531f9e78LL)), ((u64)(0x3ecada89454238a3LL)), ((u64)(0x01e1fbe5a7e78617LL)), ((u64)(0x873ec895cb496366ULL)), ((u64)(0x012d3d6f88f0b3ceLL)), ((u64)(0x290e7abb3e1bbc3fLL)), ((u64)(0x01788ccb6b2ce0c2LL)), ((u64)(0xb352196a0da2ab4fULL)), ((u64)(0x01d6affe45f818f2LL)), ((u64)(0xb0134fe24885ab11ULL)), ((u64)(0x01262dfeebbb0f97LL)), ((u64)(0x9c1823dadaa715d6ULL)), ((u64)(0x016fb97ea6a9d37dLL)), ((u64)(0x031e2cd19150db4bLL)), ((u64)(0x01cba7de5054485dLL)), ((u64)(0x21f2dc02fad2890fLL)), ((u64)(0x011f48eaf234ad3aLL)), ((u64)(0xaa6f9303b9872b53ULL)), ((u64)(0x01671b25aec1d888LL)), ((u64)(0xd50b77c4a7e8f628ULL)), ((u64)(0x01c0e1ef1a724eaaLL)), ((u64)(0xc5272adae8f199d9ULL)), ((u64)(0x01188d357087712aLL)), ((u64)(0x7670f591a32e004fLL)), ((u64)(0x015eb082cca94d75LL)), ((u64)(0xd40d32f60bf98063ULL)), ((u64)(0x01b65ca37fd3a0d2LL)), ((u64)(0xc4883fd9c77bf03eULL)), ((u64)(0x0111f9e62fe44483LL)), ((u64)(0xb5aa4fd0395aec4dULL)), ((u64)(0x0156785fbbdd55a4LL)), ((u64)(0xe314e3c447b1a760ULL)), ((u64)(0x01ac1677aad4ab0dLL)), ((u64)(0xaded0e5aaccf089cULL)), ((u64)(0x010b8e0acac4eae8LL)), ((u64)(0xd96851f15802cac3ULL)), ((u64)(0x014e718d7d7625a2LL)), ((u64)(0x8fc2666dae037d74ULL)), ((u64)(0x01a20df0dcd3af0bLL)), ((u64)(0x39d980048cc22e68LL)), ((u64)(0x010548b68a044d67LL)), ((u64)(0x084fe005aff2ba03LL)), ((u64)(0x01469ae42c8560c1LL)), ((u64)(0x4a63d8071bef6883LL)), ((u64)(0x0198419d37a6b8f1LL)), ((u64)(0x9cfcce08e2eb42a4ULL)), ((u64)(0x01fe52048590672dLL)), ((u64)(0x821e00c58dd309a7ULL)), ((u64)(0x013ef342d37a407cLL)), ((u64)(0xa2a580f6f147cc10ULL)), ((u64)(0x018eb0138858d09bLL)), ((u64)(0x8b4ee134ad99bf15ULL)), ((u64)(0x01f25c186a6f04c2LL)), ((u64)(0x97114cc0ec80176dULL)), ((u64)(0x0137798f428562f9LL)), ((u64)(0xfcd59ff127a01d48ULL)), ((u64)(0x018557f31326bbb7LL)), ((u64)(0xfc0b07ed7188249aULL)), ((u64)(0x01e6adefd7f06aa5LL)), ((u64)(0xbd86e4f466f516e0ULL)), ((u64)(0x01302cb5e6f642a7LL)), ((u64)(0xace89e3180b25c98ULL)), ((u64)(0x017c37e360b3d351LL)), ((u64)(0x1822c5bde0def3beLL)), ((u64)(0x01db45dc38e0c826LL)), ((u64)(0xcf15bb96ac8b5857ULL)), ((u64)(0x01290ba9a38c7d17LL)), ((u64)(0xc2db2a7c57ae2e6dULL)), ((u64)(0x01734e940c6f9c5dLL)), ((u64)(0x3391f51b6d99ba08LL)), ((u64)(0x01d022390f8b8375LL)), ((u64)(0x403b393124801445LL)), ((u64)(0x01221563a9b73229LL)), ((u64)(0x904a077d6da01956ULL)), ((u64)(0x016a9abc9424feb3LL)), ((u64)(0x745c895cc9081facLL)), ((u64)(0x01c5416bb92e3e60LL)), ((u64)(0x48b9d5d9fda513cbLL)), ((u64)(0x011b48e353bce6fcLL)), ((u64)(0x5ae84b507d0e58beLL)), ((u64)(0x01621b1c28ac20bbLL)), ((u64)(0x31a25e249c51eeeeLL)), ((u64)(0x01baa1e332d728eaLL)), ((u64)(0x5f057ad6e1b33554LL)), ((u64)(0x0114a52dffc67992LL)), ((u64)(0xf6c6d98c9a2002aaULL)), ((u64)(0x0159ce797fb817f6LL)), ((u64)(0xb4788fefc0a80354ULL)), ((u64)(0x01b04217dfa61df4LL)), ((u64)(0xf0cb59f5d8690214ULL)), ((u64)(0x010e294eebc7d2b8LL)), ((u64)(0x2cfe30734e83429aLL)), ((u64)(0x0151b3a2a6b9c767LL)), ((u64)(0xf83dbc9022241340ULL)), ((u64)(0x01a6208b50683940LL)), ((u64)(0x9b2695da15568c08ULL)), ((u64)(0x0107d457124123c8LL)), ((u64)(0xc1f03b509aac2f0aULL)), ((u64)(0x0149c96cd6d16cbaLL)), ((u64)(0x726c4a24c1573acdLL)), ((u64)(0x019c3bc80c85c7e9LL)), ((u64)(0xe783ae56f8d684c0ULL)), ((u64)(0x0101a55d07d39cf1LL)), ((u64)(0x616499ecb70c25f0LL)), ((u64)(0x01420eb449c8842eLL)), ((u64)(0xf9bdc067e4cf2f6cULL)), ((u64)(0x019292615c3aa539LL)), ((u64)(0x782d3081de02fb47LL)), ((u64)(0x01f736f9b3494e88LL)), ((u64)(0x4b1c3e512ac1dd0cLL)), ((u64)(0x013a825c100dd115LL)), ((u64)(0x9de34de57572544fULL)), ((u64)(0x018922f31411455aLL)), ((u64)(0x455c215ed2cee963LL)), ((u64)(0x01eb6bafd91596b1LL)), ((u64)(0xcb5994db43c151deULL)), ((u64)(0x0133234de7ad7e2eLL)), ((u64)(0x7e2ffa1214b1a655LL)), ((u64)(0x017fec216198ddbaLL)), ((u64)(0x1dbbf89699de0febLL)), ((u64)(0x01dfe729b9ff1529LL)), ((u64)(0xb2957b5e202ac9f3ULL)), ((u64)(0x012bf07a143f6d39LL)), ((u64)(0x1f3ada35a8357c6fLL)), ((u64)(0x0176ec98994f4888LL)), ((u64)(0x270990c31242db8bLL)), ((u64)(0x01d4a7bebfa31aaaLL)), ((u64)(0x5865fa79eb69c937LL)), ((u64)(0x0124e8d737c5f0aaLL)), ((u64)(0xee7f791866443b85ULL)), ((u64)(0x016e230d05b76cd4LL)), ((u64)(0x2a1f575e7fd54a66LL)), ((u64)(0x01c9abd04725480aLL)), ((u64)(0x5a53969b0fe54e80LL)), ((u64)(0x011e0b622c774d06LL)), ((u64)(0xf0e87c41d3dea220ULL)), ((u64)(0x01658e3ab7952047LL)), ((u64)(0xed229b5248d64aa8ULL)), ((u64)(0x01bef1c9657a6859LL)), ((u64)(0x3435a1136d85eea9LL)), ((u64)(0x0117571ddf6c8138LL)), ((u64)(0x4143095848e76a53LL)), ((u64)(0x015d2ce55747a186LL)), ((u64)(0xd193cbae5b2144e8ULL)), ((u64)(0x01b4781ead1989e7LL)), ((u64)(0xe2fc5f4cf8f4cb11ULL)), ((u64)(0x0110cb132c2ff630LL)), ((u64)(0x1bbb77203731fdd5LL)), ((u64)(0x0154fdd7f73bf3bdLL)), ((u64)(0x62aa54e844fe7d4aLL)), ((u64)(0x01aa3d4df50af0acLL)), ((u64)(0xbdaa75112b1f0e4eULL)), ((u64)(0x010a6650b926d66bLL)), ((u64)(0xad15125575e6d1e2ULL)), ((u64)(0x014cffe4e7708c06LL)), ((u64)(0x585a56ead360865bLL)), ((u64)(0x01a03fde214caf08LL)), ((u64)(0x37387652c41c53f8LL)), ((u64)(0x010427ead4cfed65LL)), ((u64)(0x850693e7752368f7ULL)), ((u64)(0x014531e58a03e8beLL)), ((u64)(0x264838e1526c4334LL)), ((u64)(0x01967e5eec84e2eeLL)), ((u64)(0xafda4719a7075402ULL)), ((u64)(0x01fc1df6a7a61ba9LL)), ((u64)(0x0de86c7008649481LL)), ((u64)(0x013d92ba28c7d14aLL)), ((u64)(0x9162878c0a7db9a1ULL)), ((u64)(0x018cf768b2f9c59cLL)), ((u64)(0xb5bb296f0d1d280aULL)), ((u64)(0x01f03542dfb83703LL)), ((u64)(0x5194f9e568323906LL)), ((u64)(0x01362149cbd32262LL)), ((u64)(0xe5fa385ec23ec747ULL)), ((u64)(0x0183a99c3ec7eafaLL)), ((u64)(0x9f78c67672ce7919ULL)), ((u64)(0x01e494034e79e5b9LL)), ((u64)(0x03ab7c0a07c10bb0LL)), ((u64)(0x012edc82110c2f94LL)), ((u64)(0x04965b0c89b14e9cLL)), ((u64)(0x017a93a2954f3b79LL)), ((u64)(0x45bbf1cfac1da243LL)), ((u64)(0x01d9388b3aa30a57LL)), ((u64)(0x8b957721cb92856aULL)), ((u64)(0x0127c35704a5e676LL)), ((u64)(0x2e7ad4ea3e7726c4LL)), ((u64)(0x0171b42cc5cf6014LL)), ((u64)(0x3a198a24ce14f075LL)), ((u64)(0x01ce2137f7433819LL)), ((u64)(0xc44ff65700cd1649ULL)), ((u64)(0x0120d4c2fa8a030fLL)), ((u64)(0xb563f3ecc1005bdbULL)), ((u64)(0x016909f3b92c83d3LL)), ((u64)(0xa2bcf0e7f14072d2ULL)), ((u64)(0x01c34c70a777a4c8LL)), ((u64)(0x65b61690f6c847c3LL)), ((u64)(0x011a0fc668aac6fdLL)), ((u64)(0xbf239c35347a59b4ULL)), ((u64)(0x016093b802d578bcLL)), ((u64)(0xeeec83428198f021ULL)), ((u64)(0x01b8b8a6038ad6ebLL)), ((u64)(0x7553d20990ff9615LL)), ((u64)(0x01137367c236c653LL)), ((u64)(0x52a8c68bf53f7b9aLL)), ((u64)(0x01585041b2c477e8LL)), ((u64)(0x6752f82ef28f5a81LL)), ((u64)(0x01ae64521f7595e2LL)), ((u64)(0x8093db1d57999890ULL)), ((u64)(0x010cfeb353a97dadLL)), ((u64)(0xe0b8d1e4ad7ffeb4ULL)), ((u64)(0x01503e602893dd18LL)), ((u64)(0x18e7065dd8dffe62LL)), ((u64)(0x01a44df832b8d45fLL)), ((u64)(0x6f9063faa78bfefdLL)), ((u64)(0x0106b0bb1fb384bbLL)), ((u64)(0x4b747cf9516efebcLL)), ((u64)(0x01485ce9e7a065eaLL)), ((u64)(0xde519c37a5cabe6bULL)), ((u64)(0x019a742461887f64LL)), ((u64)(0x0af301a2c79eb703LL)), ((u64)(0x01008896bcf54f9fLL)), ((u64)(0xcdafc20b798664c4ULL)), ((u64)(0x0140aabc6c32a386LL)), ((u64)(0x811bb28e57e7fdf5ULL)), ((u64)(0x0190d56b873f4c68LL)), ((u64)(0xa1629f31ede1fd72ULL)), ((u64)(0x01f50ac6690f1f82LL)), ((u64)(0xa4dda37f34ad3e67ULL)), ((u64)(0x013926bc01a973b1LL)), ((u64)(0x0e150c5f01d88e01LL)), ((u64)(0x0187706b0213d09eLL)), ((u64)(0x919a4f76c24eb181ULL)), ((u64)(0x01e94c85c298c4c5LL)), ((u64)(0x7b0071aa39712ef1LL)), ((u64)(0x0131cfd3999f7afbLL)), ((u64)(0x59c08e14c7cd7aadLL)), ((u64)(0x017e43c8800759baLL)), ((u64)(0xf030b199f9c0d958ULL)), ((u64)(0x01ddd4baa0093028LL)), ((u64)(0x961e6f003c1887d7ULL)), ((u64)(0x012aa4f4a405be19LL)), ((u64)(0xfba60ac04b1ea9cdULL)), ((u64)(0x01754e31cd072d9fLL)), ((u64)(0xfa8f8d705de65440ULL)), ((u64)(0x01d2a1be4048f907LL)), ((u64)(0xfc99b8663aaff4a8ULL)), ((u64)(0x0123a516e82d9ba4LL)), ((u64)(0x3bc0267fc95bf1d2LL)), ((u64)(0x016c8e5ca239028eLL)), ((u64)(0xcab0301fbbb2ee47ULL)), ((u64)(0x01c7b1f3cac74331LL)), ((u64)(0x1eae1e13d54fd4ecLL)), ((u64)(0x011ccf385ebc89ffLL)), ((u64)(0xe659a598caa3ca27ULL)), ((u64)(0x01640306766bac7eLL)), ((u64)(0x9ff00efefd4cbcb1ULL)), ((u64)(0x01bd03c81406979eLL)), ((u64)(0x23f6095f5e4ff5efLL)), ((u64)(0x0116225d0c841ec3LL)), ((u64)(0xecf38bb735e3f36aULL)), ((u64)(0x015baaf44fa52673LL)), ((u64)(0xe8306ea5035cf045ULL)), ((u64)(0x01b295b1638e7010LL)), ((u64)(0x911e4527221a162bULL)), ((u64)(0x010f9d8ede39060aLL)), ((u64)(0x3565d670eaa09bb6LL)), ((u64)(0x015384f295c7478dLL)), ((u64)(0x82bf4c0d2548c2a3ULL)), ((u64)(0x01a8662f3b391970LL)), ((u64)(0x51b78f88374d79a6LL)), ((u64)(0x01093fdd8503afe6LL)), ((u64)(0xe625736a4520d810ULL)), ((u64)(0x014b8fd4e6449bdfLL)), ((u64)(0xdfaed044d6690e14ULL)), ((u64)(0x019e73ca1fd5c2d7LL)), ((u64)(0xebcd422b0601a8ccULL)), ((u64)(0x0103085e53e599c6LL)), ((u64)(0xa6c092b5c78212ffULL)), ((u64)(0x0143ca75e8df0038LL)), ((u64)(0xd070b763396297bfULL)), ((u64)(0x0194bd136316c046LL)), ((u64)(0x848ce53c07bb3dafULL)), ((u64)(0x01f9ec583bdc7058LL)), ((u64)(0x52d80f4584d5068dLL)), ((u64)(0x013c33b72569c637LL)), ((u64)(0x278e1316e60a4831LL)), ((u64)(0x018b40a4eec437c5LL))}; // fixed array const static Array_fixed_u64_584 _const_strconv__pow5_inv_split_64_x = {((u64)(0x0000000000000001)), ((u64)(0x0400000000000000LL)), ((u64)(0x3333333333333334LL)), ((u64)(0x0333333333333333LL)), ((u64)(0x28f5c28f5c28f5c3LL)), ((u64)(0x028f5c28f5c28f5cLL)), ((u64)(0xed916872b020c49cULL)), ((u64)(0x020c49ba5e353f7cLL)), ((u64)(0xaf4f0d844d013a93ULL)), ((u64)(0x0346dc5d63886594LL)), ((u64)(0x8c3f3e0370cdc876ULL)), ((u64)(0x029f16b11c6d1e10LL)), ((u64)(0xd698fe69270b06c5ULL)), ((u64)(0x0218def416bdb1a6LL)), ((u64)(0xf0f4ca41d811a46eULL)), ((u64)(0x035afe535795e90aLL)), ((u64)(0xf3f70834acdae9f1ULL)), ((u64)(0x02af31dc4611873bLL)), ((u64)(0x5cc5a02a23e254c1LL)), ((u64)(0x0225c17d04dad296LL)), ((u64)(0xfad5cd10396a2135ULL)), ((u64)(0x036f9bfb3af7b756LL)), ((u64)(0xfbde3da69454e75eULL)), ((u64)(0x02bfaffc2f2c92abLL)), ((u64)(0x2fe4fe1edd10b918LL)), ((u64)(0x0232f33025bd4223LL)), ((u64)(0x4ca19697c81ac1bfLL)), ((u64)(0x0384b84d092ed038LL)), ((u64)(0x3d4e1213067bce33LL)), ((u64)(0x02d09370d4257360LL)), ((u64)(0x643e74dc052fd829LL)), ((u64)(0x024075f3dceac2b3LL)), ((u64)(0x6d30baf9a1e626a7LL)), ((u64)(0x039a5652fb113785LL)), ((u64)(0x2426fbfae7eb5220LL)), ((u64)(0x02e1dea8c8da92d1LL)), ((u64)(0x1cebfcc8b9890e80LL)), ((u64)(0x024e4bba3a487574LL)), ((u64)(0x94acc7a78f41b0ccULL)), ((u64)(0x03b07929f6da5586LL)), ((u64)(0xaa23d2ec729af3d7ULL)), ((u64)(0x02f394219248446bLL)), ((u64)(0xbb4fdbf05baf2979ULL)), ((u64)(0x025c768141d369efLL)), ((u64)(0xc54c931a2c4b758dULL)), ((u64)(0x03c7240202ebdcb2LL)), ((u64)(0x9dd6dc14f03c5e0bULL)), ((u64)(0x0305b66802564a28LL)), ((u64)(0x4b1249aa59c9e4d6LL)), ((u64)(0x026af8533511d4edLL)), ((u64)(0x44ea0f76f60fd489LL)), ((u64)(0x03de5a1ebb4fbb15LL)), ((u64)(0x6a54d92bf80caa07LL)), ((u64)(0x0318481895d96277LL)), ((u64)(0x21dd7a89933d54d2LL)), ((u64)(0x0279d346de4781f9LL)), ((u64)(0x362f2a75b8622150LL)), ((u64)(0x03f61ed7ca0c0328LL)), ((u64)(0xf825bb91604e810dULL)), ((u64)(0x032b4bdfd4d668ecLL)), ((u64)(0xc684960de6a5340bULL)), ((u64)(0x0289097fdd7853f0LL)), ((u64)(0xd203ab3e521dc33cULL)), ((u64)(0x02073accb12d0ff3LL)), ((u64)(0xe99f7863b696052cULL)), ((u64)(0x033ec47ab514e652LL)), ((u64)(0x87b2c6b62bab3757ULL)), ((u64)(0x02989d2ef743eb75LL)), ((u64)(0xd2f56bc4efbc2c45ULL)), ((u64)(0x0213b0f25f69892aLL)), ((u64)(0x1e55793b192d13a2LL)), ((u64)(0x0352b4b6ff0f41deLL)), ((u64)(0x4b77942f475742e8LL)), ((u64)(0x02a8909265a5ce4bLL)), ((u64)(0xd5f9435905df68baULL)), ((u64)(0x022073a8515171d5LL)), ((u64)(0x565b9ef4d6324129LL)), ((u64)(0x03671f73b54f1c89LL)), ((u64)(0xdeafb25d78283421ULL)), ((u64)(0x02b8e5f62aa5b06dLL)), ((u64)(0x188c8eb12cecf681LL)), ((u64)(0x022d84c4eeeaf38bLL)), ((u64)(0x8dadb11b7b14bd9bULL)), ((u64)(0x037c07a17e44b8deLL)), ((u64)(0x7157c0e2c8dd647cLL)), ((u64)(0x02c99fb46503c718LL)), ((u64)(0x8ddfcd823a4ab6caULL)), ((u64)(0x023ae629ea696c13LL)), ((u64)(0x1632e269f6ddf142LL)), ((u64)(0x0391704310a8acecLL)), ((u64)(0x44f581ee5f17f435LL)), ((u64)(0x02dac035a6ed5723LL)), ((u64)(0x372ace584c1329c4LL)), ((u64)(0x024899c4858aac1cLL)), ((u64)(0xbeaae3c079b842d3ULL)), ((u64)(0x03a75c6da27779c6LL)), ((u64)(0x6555830061603576LL)), ((u64)(0x02ec49f14ec5fb05LL)), ((u64)(0xb7779c004de6912bULL)), ((u64)(0x0256a18dd89e626aLL)), ((u64)(0xf258f99a163db512ULL)), ((u64)(0x03bdcf495a9703ddLL)), ((u64)(0x5b7a614811caf741LL)), ((u64)(0x02fe3f6de212697eLL)), ((u64)(0xaf951aa00e3bf901ULL)), ((u64)(0x0264ff8b1b41edfeLL)), ((u64)(0x7f54f7667d2cc19bLL)), ((u64)(0x03d4cc11c5364997LL)), ((u64)(0x32aa5f8530f09ae3LL)), ((u64)(0x0310a3416a91d479LL)), ((u64)(0xf55519375a5a1582ULL)), ((u64)(0x0273b5cdeedb1060LL)), ((u64)(0xbbbb5b8bc3c3559dULL)), ((u64)(0x03ec56164af81a34LL)), ((u64)(0x2fc916096969114aLL)), ((u64)(0x03237811d593482aLL)), ((u64)(0x596dab3ababa743cLL)), ((u64)(0x0282c674aadc39bbLL)), ((u64)(0x478aef622efb9030LL)), ((u64)(0x0202385d557cfafcLL)), ((u64)(0xd8de4bd04b2c19e6ULL)), ((u64)(0x0336c0955594c4c6LL)), ((u64)(0xad7ea30d08f014b8ULL)), ((u64)(0x029233aaaadd6a38LL)), ((u64)(0x24654f3da0c01093LL)), ((u64)(0x020e8fbbbbe454faLL)), ((u64)(0x3a3bb1fc346680ebLL)), ((u64)(0x034a7f92c63a2190LL)), ((u64)(0x94fc8e635d1ecd89ULL)), ((u64)(0x02a1ffa89e94e7a6LL)), ((u64)(0xaa63a51c4a7f0ad4ULL)), ((u64)(0x021b32ed4baa52ebLL)), ((u64)(0xdd6c3b607731aaedULL)), ((u64)(0x035eb7e212aa1e45LL)), ((u64)(0x1789c919f8f488bdLL)), ((u64)(0x02b22cb4dbbb4b6bLL)), ((u64)(0xac6e3a7b2d906d64ULL)), ((u64)(0x022823c3e2fc3c55LL)), ((u64)(0x13e390c515b3e23aLL)), ((u64)(0x03736c6c9e606089LL)), ((u64)(0xdcb60d6a77c31b62ULL)), ((u64)(0x02c2bd23b1e6b3a0LL)), ((u64)(0x7d5e7121f968e2b5LL)), ((u64)(0x0235641c8e52294dLL)), ((u64)(0xc8971b698f0e3787ULL)), ((u64)(0x0388a02db0837548LL)), ((u64)(0xa078e2bad8d82c6cULL)), ((u64)(0x02d3b357c0692aa0LL)), ((u64)(0xe6c71bc8ad79bd24ULL)), ((u64)(0x0242f5dfcd20eee6LL)), ((u64)(0x0ad82c7448c2c839LL)), ((u64)(0x039e5632e1ce4b0bLL)), ((u64)(0x3be023903a356cfaLL)), ((u64)(0x02e511c24e3ea26fLL)), ((u64)(0x2fe682d9c82abd95LL)), ((u64)(0x0250db01d8321b8cLL)), ((u64)(0x4ca4048fa6aac8eeLL)), ((u64)(0x03b4919c8d1cf8e0LL)), ((u64)(0x3d5003a61eef0725LL)), ((u64)(0x02f6dae3a4172d80LL)), ((u64)(0x9773361e7f259f51ULL)), ((u64)(0x025f1582e9ac2466LL)), ((u64)(0x8beb89ca6508fee8ULL)), ((u64)(0x03cb559e42ad070aLL)), ((u64)(0x6fefa16eb73a6586LL)), ((u64)(0x0309114b688a6c08LL)), ((u64)(0xf3261abef8fb846bULL)), ((u64)(0x026da76f86d52339LL)), ((u64)(0x51d691318e5f3a45LL)), ((u64)(0x03e2a57f3e21d1f6LL)), ((u64)(0x0e4540f471e5c837LL)), ((u64)(0x031bb798fe8174c5LL)), ((u64)(0xd8376729f4b7d360ULL)), ((u64)(0x027c92e0cb9ac3d0LL)), ((u64)(0xf38bd84321261effULL)), ((u64)(0x03fa849adf5e061aLL)), ((u64)(0x293cad0280eb4bffLL)), ((u64)(0x032ed07be5e4d1afLL)), ((u64)(0xedca240200bc3cccULL)), ((u64)(0x028bd9fcb7ea4158LL)), ((u64)(0xbe3b50019a3030a4ULL)), ((u64)(0x02097b309321cde0LL)), ((u64)(0xc9f88002904d1a9fULL)), ((u64)(0x03425eb41e9c7c9aLL)), ((u64)(0x3b2d3335403daee6LL)), ((u64)(0x029b7ef67ee396e2LL)), ((u64)(0x95bdc291003158b8ULL)), ((u64)(0x0215ff2b98b6124eLL)), ((u64)(0x892f9db4cd1bc126ULL)), ((u64)(0x035665128df01d4aLL)), ((u64)(0x07594af70a7c9a85LL)), ((u64)(0x02ab840ed7f34aa2LL)), ((u64)(0x6c476f2c0863aed1LL)), ((u64)(0x0222d00bdff5d54eLL)), ((u64)(0x13a57eacda3917b4LL)), ((u64)(0x036ae67966562217LL)), ((u64)(0x0fb7988a482dac90LL)), ((u64)(0x02bbeb9451de81acLL)), ((u64)(0xd95fad3b6cf156daULL)), ((u64)(0x022fefa9db1867bcLL)), ((u64)(0xf565e1f8ae4ef15cULL)), ((u64)(0x037fe5dc91c0a5faLL)), ((u64)(0x911e4e608b725ab0ULL)), ((u64)(0x02ccb7e3a7cd5195LL)), ((u64)(0xda7ea51a0928488dULL)), ((u64)(0x023d5fe9530aa7aaLL)), ((u64)(0xf7310829a8407415ULL)), ((u64)(0x039566421e7772aaLL)), ((u64)(0x2c2739baed005cdeLL)), ((u64)(0x02ddeb68185f8eefLL)), ((u64)(0xbcec2e2f24004a4bULL)), ((u64)(0x024b22b9ad193f25LL)), ((u64)(0x94ad16b1d333aa11ULL)), ((u64)(0x03ab6ac2ae8ecb6fLL)), ((u64)(0xaa241227dc2954dbULL)), ((u64)(0x02ef889bbed8a2bfLL)), ((u64)(0x54e9a81fe35443e2LL)), ((u64)(0x02593a163246e899LL)), ((u64)(0x2175d9cc9eed396aLL)), ((u64)(0x03c1f689ea0b0dc2LL)), ((u64)(0xe7917b0a18bdc788ULL)), ((u64)(0x03019207ee6f3e34LL)), ((u64)(0xb9412f3b46fe393aULL)), ((u64)(0x0267a8065858fe90LL)), ((u64)(0xf535185ed7fd285cULL)), ((u64)(0x03d90cd6f3c1974dLL)), ((u64)(0xc42a79e57997537dULL)), ((u64)(0x03140a458fce12a4LL)), ((u64)(0x03552e512e12a931LL)), ((u64)(0x02766e9e0ca4dbb7LL)), ((u64)(0x9eeeb081e3510eb4ULL)), ((u64)(0x03f0b0fce107c5f1LL)), ((u64)(0x4bf226ce4f740bc3LL)), ((u64)(0x0326f3fd80d304c1LL)), ((u64)(0xa3281f0b72c33c9cULL)), ((u64)(0x02858ffe00a8d09aLL)), ((u64)(0x1c2018d5f568fd4aLL)), ((u64)(0x020473319a20a6e2LL)), ((u64)(0xf9ccf48988a7fba9ULL)), ((u64)(0x033a51e8f69aa49cLL)), ((u64)(0xfb0a5d3ad3b99621ULL)), ((u64)(0x02950e53f87bb6e3LL)), ((u64)(0x2f3b7dc8a96144e7LL)), ((u64)(0x0210d8432d2fc583LL)), ((u64)(0xe52bfc7442353b0cULL)), ((u64)(0x034e26d1e1e608d1LL)), ((u64)(0xb756639034f76270ULL)), ((u64)(0x02a4ebdb1b1e6d74LL)), ((u64)(0x2c451c735d92b526LL)), ((u64)(0x021d897c15b1f12aLL)), ((u64)(0x13a1c71efc1deea3LL)), ((u64)(0x0362759355e981ddLL)), ((u64)(0x761b05b2634b2550LL)), ((u64)(0x02b52adc44bace4aLL)), ((u64)(0x91af37c1e908eaa6ULL)), ((u64)(0x022a88b036fbd83bLL)), ((u64)(0x82b1f2cfdb417770ULL)), ((u64)(0x03774119f192f392LL)), ((u64)(0xcef4c23fe29ac5f3ULL)), ((u64)(0x02c5cdae5adbf60eLL)), ((u64)(0x3f2a34ffe87bd190LL)), ((u64)(0x0237d7beaf165e72LL)), ((u64)(0x984387ffda5fb5b2ULL)), ((u64)(0x038c8c644b56fd83LL)), ((u64)(0xe0360666484c915bULL)), ((u64)(0x02d6d6b6a2abfe02LL)), ((u64)(0x802b3851d3707449ULL)), ((u64)(0x024578921bbccb35LL)), ((u64)(0x99dec082ebe72075ULL)), ((u64)(0x03a25a835f947855LL)), ((u64)(0xae4bcd358985b391ULL)), ((u64)(0x02e8486919439377LL)), ((u64)(0xbea30a913ad15c74ULL)), ((u64)(0x02536d20e102dc5fLL)), ((u64)(0xfdd1aa81f7b560b9ULL)), ((u64)(0x03b8ae9b019e2d65LL)), ((u64)(0x97daeece5fc44d61ULL)), ((u64)(0x02fa2548ce182451LL)), ((u64)(0xdfe258a51969d781ULL)), ((u64)(0x0261b76d71ace9daLL)), ((u64)(0x996a276e8f0fbf34ULL)), ((u64)(0x03cf8be24f7b0fc4LL)), ((u64)(0xe121b9253f3fcc2aULL)), ((u64)(0x030c6fe83f95a636LL)), ((u64)(0xb41afa8432997022ULL)), ((u64)(0x02705986994484f8LL)), ((u64)(0xecf7f739ea8f19cfULL)), ((u64)(0x03e6f5a4286da18dLL)), ((u64)(0x23f99294bba5ae40LL)), ((u64)(0x031f2ae9b9f14e0bLL)), ((u64)(0x4ffadbaa2fb7be99LL)), ((u64)(0x027f5587c7f43e6fLL)), ((u64)(0x7ff7c5dd1925fdc2LL)), ((u64)(0x03feef3fa6539718LL)), ((u64)(0xccc637e4141e649bULL)), ((u64)(0x033258ffb842df46LL)), ((u64)(0xd704f983434b83afULL)), ((u64)(0x028ead9960357f6bLL)), ((u64)(0x126a6135cf6f9c8cLL)), ((u64)(0x020bbe144cf79923LL)), ((u64)(0x83dd685618b29414ULL)), ((u64)(0x0345fced47f28e9eLL)), ((u64)(0x9cb12044e08edcddULL)), ((u64)(0x029e63f1065ba54bLL)), ((u64)(0x16f419d0b3a57d7dLL)), ((u64)(0x02184ff405161dd6LL)), ((u64)(0x8b20294dec3bfbfbULL)), ((u64)(0x035a19866e89c956LL)), ((u64)(0x3c19baa4bcfcc996LL)), ((u64)(0x02ae7ad1f207d445LL)), ((u64)(0xc9ae2eea30ca3adfULL)), ((u64)(0x02252f0e5b39769dLL)), ((u64)(0x0f7d17dd1add2afdLL)), ((u64)(0x036eb1b091f58a96LL)), ((u64)(0x3f97464a7be42264LL)), ((u64)(0x02bef48d41913babLL)), ((u64)(0xcc790508631ce850ULL)), ((u64)(0x02325d3dce0dc955LL)), ((u64)(0xe0c1a1a704fb0d4dULL)), ((u64)(0x0383c862e3494222LL)), ((u64)(0x4d67b4859d95a43eLL)), ((u64)(0x02cfd3824f6dce82LL)), ((u64)(0x711fc39e17aae9cbLL)), ((u64)(0x023fdc683f8b0b9bLL)), ((u64)(0xe832d2968c44a945ULL)), ((u64)(0x039960a6cc11ac2bLL)), ((u64)(0xecf575453d03ba9eULL)), ((u64)(0x02e11a1f09a7bcefLL)), ((u64)(0x572ac4376402fbb1LL)), ((u64)(0x024dae7f3aec9726LL)), ((u64)(0x58446d256cd192b5LL)), ((u64)(0x03af7d985e47583dLL)), ((u64)(0x79d0575123dadbc4LL)), ((u64)(0x02f2cae04b6c4697LL)), ((u64)(0x94a6ac40e97be303ULL)), ((u64)(0x025bd5803c569edfLL)), ((u64)(0x8771139b0f2c9e6cULL)), ((u64)(0x03c62266c6f0fe32LL)), ((u64)(0x9f8da948d8f07ebdULL)), ((u64)(0x0304e85238c0cb5bLL)), ((u64)(0xe60aedd3e0c06564ULL)), ((u64)(0x026a5374fa33d5e2LL)), ((u64)(0xa344afb9679a3bd2ULL)), ((u64)(0x03dd5254c3862304LL)), ((u64)(0xe903bfc78614fca8ULL)), ((u64)(0x031775109c6b4f36LL)), ((u64)(0xba6966393810ca20ULL)), ((u64)(0x02792a73b055d8f8LL)), ((u64)(0x2a423d2859b4769aLL)), ((u64)(0x03f510b91a22f4c1LL)), ((u64)(0xee9b642047c39215ULL)), ((u64)(0x032a73c7481bf700LL)), ((u64)(0xbee2b680396941aaULL)), ((u64)(0x02885c9f6ce32c00LL)), ((u64)(0xff1bc53361210155ULL)), ((u64)(0x0206b07f8a4f5666LL)), ((u64)(0x31c6085235019bbbLL)), ((u64)(0x033de73276e5570bLL)), ((u64)(0x27d1a041c4014963LL)), ((u64)(0x0297ec285f1ddf3cLL)), ((u64)(0xeca7b367d0010782ULL)), ((u64)(0x021323537f4b18fcLL)), ((u64)(0xadd91f0c8001a59dULL)), ((u64)(0x0351d21f3211c194LL)), ((u64)(0xf17a7f3d3334847eULL)), ((u64)(0x02a7db4c280e3476LL)), ((u64)(0x279532975c2a0398LL)), ((u64)(0x021fe2a3533e905fLL)), ((u64)(0xd8eeb75893766c26ULL)), ((u64)(0x0366376bb8641a31LL)), ((u64)(0x7a5892ad42c52352LL)), ((u64)(0x02b82c562d1ce1c1LL)), ((u64)(0xfb7a0ef102374f75ULL)), ((u64)(0x022cf044f0e3e7cdLL)), ((u64)(0xc59017e8038bb254ULL)), ((u64)(0x037b1a07e7d30c7cLL)), ((u64)(0x37a67986693c8eaaLL)), ((u64)(0x02c8e19feca8d6caLL)), ((u64)(0xf951fad1edca0bbbULL)), ((u64)(0x023a4e198a20abd4LL)), ((u64)(0x28832ae97c76792bLL)), ((u64)(0x03907cf5a9cddfbbLL)), ((u64)(0x2068ef21305ec756LL)), ((u64)(0x02d9fd9154a4b2fcLL)), ((u64)(0x19ed8c1a8d189f78LL)), ((u64)(0x0247fe0ddd508f30LL)), ((u64)(0x5caf4690e1c0ff26LL)), ((u64)(0x03a66349621a7eb3LL)), ((u64)(0x4a25d20d81673285LL)), ((u64)(0x02eb82a11b48655cLL)), ((u64)(0x3b5174d79ab8f537LL)), ((u64)(0x0256021a7c39eab0LL)), ((u64)(0x921bee25c45b21f1ULL)), ((u64)(0x03bcd02a605caab3LL)), ((u64)(0xdb498b5169e2818eULL)), ((u64)(0x02fd735519e3bbc2LL)), ((u64)(0x15d46f7454b53472LL)), ((u64)(0x02645c4414b62fcfLL)), ((u64)(0xefba4bed545520b6ULL)), ((u64)(0x03d3c6d35456b2e4LL)), ((u64)(0xf2fb6ff110441a2bULL)), ((u64)(0x030fd242a9def583LL)), ((u64)(0x8f2f8cc0d9d014efULL)), ((u64)(0x02730e9bbb18c469LL)), ((u64)(0xb1e5ae015c80217fULL)), ((u64)(0x03eb4a92c4f46d75LL)), ((u64)(0xc1848b344a001accULL)), ((u64)(0x0322a20f03f6bdf7LL)), ((u64)(0xce03a2903b3348a3ULL)), ((u64)(0x02821b3f365efe5fLL)), ((u64)(0xd802e873628f6d4fULL)), ((u64)(0x0201af65c518cb7fLL)), ((u64)(0x599e40b89db2487fLL)), ((u64)(0x0335e56fa1c14599LL)), ((u64)(0xe14b66fa17c1d399ULL)), ((u64)(0x029184594e3437adLL)), ((u64)(0x81091f2e7967dc7aULL)), ((u64)(0x020e037aa4f692f1LL)), ((u64)(0x9b41cb7d8f0c93f6ULL)), ((u64)(0x03499f2aa18a84b5LL)), ((u64)(0xaf67d5fe0c0a0ff8ULL)), ((u64)(0x02a14c221ad536f7LL)), ((u64)(0xf2b977fe70080cc7ULL)), ((u64)(0x021aa34e7bddc592LL)), ((u64)(0x1df58cca4cd9ae0bLL)), ((u64)(0x035dd2172c9608ebLL)), ((u64)(0xe4c470a1d7148b3cULL)), ((u64)(0x02b174df56de6d88LL)), ((u64)(0x83d05a1b1276d5caULL)), ((u64)(0x022790b2abe5246dLL)), ((u64)(0x9fb3c35e83f1560fULL)), ((u64)(0x0372811ddfd50715LL)), ((u64)(0xb2f635e5365aab3fULL)), ((u64)(0x02c200e4b310d277LL)), ((u64)(0xf591c4b75eaeef66ULL)), ((u64)(0x0234cd83c273db92LL)), ((u64)(0xef4fa125644b18a3ULL)), ((u64)(0x0387af39371fc5b7LL)), ((u64)(0x8c3fb41de9d5ad4fULL)), ((u64)(0x02d2f2942c196af9LL)), ((u64)(0x3cffc34b2177bdd9LL)), ((u64)(0x02425ba9bce12261LL)), ((u64)(0x94cc6bab68bf9628ULL)), ((u64)(0x039d5f75fb01d09bLL)), ((u64)(0x10a38955ed6611b9LL)), ((u64)(0x02e44c5e6267da16LL)), ((u64)(0xda1c6dde5784dafbULL)), ((u64)(0x02503d184eb97b44LL)), ((u64)(0xf693e2fd58d49191ULL)), ((u64)(0x03b394f3b128c53aLL)), ((u64)(0xc5431bfde0aa0e0eULL)), ((u64)(0x02f610c2f4209dc8LL)), ((u64)(0x6a9c1664b3bb3e72LL)), ((u64)(0x025e73cf29b3b16dLL)), ((u64)(0x10f9bd6dec5eca4fLL)), ((u64)(0x03ca52e50f85e8afLL)), ((u64)(0xda616457f04bd50cULL)), ((u64)(0x03084250d937ed58LL)), ((u64)(0xe1e783798d09773dULL)), ((u64)(0x026d01da475ff113LL)), ((u64)(0x030c058f480f252eLL)), ((u64)(0x03e19c9072331b53LL)), ((u64)(0x68d66ad906728425LL)), ((u64)(0x031ae3a6c1c27c42LL)), ((u64)(0x8711ef14052869b7ULL)), ((u64)(0x027be952349b969bLL)), ((u64)(0x0b4fe4ecd50d75f2LL)), ((u64)(0x03f97550542c242cLL)), ((u64)(0xa2a650bd773df7f5ULL)), ((u64)(0x032df7737689b689LL)), ((u64)(0xb551da312c31932aULL)), ((u64)(0x028b2c5c5ed49207LL)), ((u64)(0x5ddb14f4235adc22LL)), ((u64)(0x0208f049e576db39LL)), ((u64)(0x2fc4ee536bc49369LL)), ((u64)(0x034180763bf15ec2LL)), ((u64)(0xbfd0bea92303a921ULL)), ((u64)(0x029acd2b63277f01LL)), ((u64)(0x9973cbba8269541aULL)), ((u64)(0x021570ef8285ff34LL)), ((u64)(0x5bec792a6a42202aLL)), ((u64)(0x0355817f373ccb87LL)), ((u64)(0xe3239421ee9b4cefULL)), ((u64)(0x02aacdff5f63d605LL)), ((u64)(0xb5b6101b25490a59ULL)), ((u64)(0x02223e65e5e97804LL)), ((u64)(0x22bce691d541aa27LL)), ((u64)(0x0369fd6fd64259a1LL)), ((u64)(0xb563eba7ddce21b9ULL)), ((u64)(0x02bb31264501e14dLL)), ((u64)(0xf78322ecb171b494ULL)), ((u64)(0x022f5a850401810aLL)), ((u64)(0x259e9e47824f8753LL)), ((u64)(0x037ef73b399c01abLL)), ((u64)(0x1e187e9f9b72d2a9LL)), ((u64)(0x02cbf8fc2e1667bcLL)), ((u64)(0x4b46cbb2e2c24221LL)), ((u64)(0x023cc73024deb963LL)), ((u64)(0x120adf849e039d01LL)), ((u64)(0x039471e6a1645bd2LL)), ((u64)(0xdb3be603b19c7d9aULL)), ((u64)(0x02dd27ebb4504974LL)), ((u64)(0x7c2feb3627b0647cLL)), ((u64)(0x024a865629d9d45dLL)), ((u64)(0x2d197856a5e7072cLL)), ((u64)(0x03aa7089dc8fba2fLL)), ((u64)(0x8a7ac6abb7ec05bdULL)), ((u64)(0x02eec06e4a0c94f2LL)), ((u64)(0xd52f05562cbcd164ULL)), ((u64)(0x025899f1d4d6dd8eLL)), ((u64)(0x21e4d556adfae8a0LL)), ((u64)(0x03c0f64fbaf1627eLL)), ((u64)(0xe7ea444557fbed4dULL)), ((u64)(0x0300c50c958de864LL)), ((u64)(0xecbb69d1132ff10aULL)), ((u64)(0x0267040a113e5383LL)), ((u64)(0xadf8a94e851981aaULL)), ((u64)(0x03d8067681fd526cLL)), ((u64)(0x8b2d543ed0e13488ULL)), ((u64)(0x0313385ece6441f0LL)), ((u64)(0xd5bddcff0d80f6d3ULL)), ((u64)(0x0275c6b23eb69b26LL)), ((u64)(0x892fc7fe7c018aebULL)), ((u64)(0x03efa45064575ea4LL)), ((u64)(0x3a8c9ffec99ad589LL)), ((u64)(0x03261d0d1d12b21dLL)), ((u64)(0xc8707fff07af113bULL)), ((u64)(0x0284e40a7da88e7dLL)), ((u64)(0x39f39998d2f2742fLL)), ((u64)(0x0203e9a1fe2071feLL)), ((u64)(0x8fec28f484b7204bULL)), ((u64)(0x033975cffd00b663LL)), ((u64)(0xd989ba5d36f8e6a2ULL)), ((u64)(0x02945e3ffd9a2b82LL)), ((u64)(0x47a161e42bfa521cLL)), ((u64)(0x02104b66647b5602LL)), ((u64)(0x0c35696d132a1cf9LL)), ((u64)(0x034d4570a0c5566aLL)), ((u64)(0x09c454574288172dLL)), ((u64)(0x02a4378d4d6aab88LL)), ((u64)(0xa169dd129ba0128bULL)), ((u64)(0x021cf93dd7888939LL)), ((u64)(0x0242fb50f9001dabLL)), ((u64)(0x03618ec958da7529LL)), ((u64)(0x9b68c90d940017bcULL)), ((u64)(0x02b4723aad7b90edLL)), ((u64)(0x4920a0d7a999ac96LL)), ((u64)(0x0229f4fbbdfc73f1LL)), ((u64)(0x750101590f5c4757LL)), ((u64)(0x037654c5fcc71fe8LL)), ((u64)(0x2a6734473f7d05dfLL)), ((u64)(0x02c5109e63d27fedLL)), ((u64)(0xeeb8f69f65fd9e4cULL)), ((u64)(0x0237407eb641fff0LL)), ((u64)(0xe45b24323cc8fd46ULL)), ((u64)(0x038b9a6456cfffe7LL)), ((u64)(0xb6af502830a0ca9fULL)), ((u64)(0x02d6151d123fffecLL)), ((u64)(0xf88c402026e7087fULL)), ((u64)(0x0244ddb0db666656LL)), ((u64)(0x2746cd003e3e73feLL)), ((u64)(0x03a162b4923d708bLL)), ((u64)(0x1f6bd73364fec332LL)), ((u64)(0x02e7822a0e978d3cLL)), ((u64)(0xe5efdf5c50cbcf5bULL)), ((u64)(0x0252ce880bac70fcLL)), ((u64)(0x3cb2fefa1adfb22bLL)), ((u64)(0x03b7b0d9ac471b2eLL)), ((u64)(0x308f3261af195b56LL)), ((u64)(0x02f95a47bd05af58LL)), ((u64)(0x5a0c284e25ade2abLL)), ((u64)(0x0261150630d15913LL)), ((u64)(0x29ad0d49d5e30445LL)), ((u64)(0x03ce8809e7b55b52LL)), ((u64)(0x548a7107de4f369dLL)), ((u64)(0x030ba007ec9115dbLL)), ((u64)(0xdd3b8d9fe50c2bb1ULL)), ((u64)(0x026fb3398a0dab15LL)), ((u64)(0x952c15cca1ad12b5ULL)), ((u64)(0x03e5eb8f434911bcLL)), ((u64)(0x775677d6e7bda891LL)), ((u64)(0x031e560c35d40e30LL)), ((u64)(0xc5dec645863153a7ULL)), ((u64)(0x027eab3cf7dcd826LL))}; // fixed array const bool v_memory_panic = false; // global 6 int_literal g_autostr_type_stack_len = 0; // global 6 int_literal g_autostr_addr_stack_len = 0; // global 6 int g_main_argc = ((int)(0)); // global 6 voidptr g_main_argv = ((void*)0); // global 6 voidptr g_live_reload_info; // global 6 /* skip C global: stdout */ /* skip C global: stderr */ /* skip C global: _wyp */ static IError _const_error_sentinel; // inited later static IError _const_none__; // inited later static const i8 _const_min_i8 = -128; // precomputed2 static const i8 _const_max_i8 = 127; // precomputed2 static const i16 _const_min_i16 = -32768; // precomputed2 static const i16 _const_max_i16 = 32767; // precomputed2 static const i32 _const_min_i32 = -2147483648; // precomputed2 static const i32 _const_max_i32 = 2147483647; // precomputed2 static i64 _const_min_i64; // inited later static i64 _const_max_i64; // inited later static const u8 _const_min_u8 = 0; // precomputed2 static const u8 _const_max_u8 = 255; // precomputed2 static const u16 _const_min_u16 = 0; // precomputed2 static const u16 _const_max_u16 = 65535; // precomputed2 static const u32 _const_min_u32 = 0; // precomputed2 static const u32 _const_max_u32 = 4294967295; // precomputed2 static const u64 _const_min_u64 = 0U; // precomputed2 static const u64 _const_max_u64 = 18446744073709551615U; // precomputed2 static const u32 _const_hash_mask = 16777215; // precomputed2 static const u32 _const_probe_inc = 16777216; // precomputed2 static Array_fixed_i32_1264 _const_rune_maps = {((i32)(0xB5)), 0xB5, 743, 0, 0xC0, 0xD6, 0, 32, 0xD8, 0xDE, 0, 32, 0xE0, 0xF6, -32, 0, 0xF8, 0xFE, -32, 0, 0xFF, 0xFF, 121, 0, 0x100, 0x12F, -3, -3, 0x130, 0x130, 0, -199, 0x131, 0x131, -232, 0, 0x132, 0x137, -3, -3, 0x139, 0x148, -3, -3, 0x14A, 0x177, -3, -3, 0x178, 0x178, 0, -121, 0x179, 0x17E, -3, -3, 0x17F, 0x17F, -300, 0, 0x180, 0x180, 195, 0, 0x181, 0x181, 0, 210, 0x182, 0x185, -3, -3, 0x186, 0x186, 0, 206, 0x187, 0x188, -3, -3, 0x189, 0x18A, 0, 205, 0x18B, 0x18C, -3, -3, 0x18E, 0x18E, 0, 79, 0x18F, 0x18F, 0, 202, 0x190, 0x190, 0, 203, 0x191, 0x192, -3, -3, 0x193, 0x193, 0, 205, 0x194, 0x194, 0, 207, 0x195, 0x195, 97, 0, 0x196, 0x196, 0, 211, 0x197, 0x197, 0, 209, 0x198, 0x199, -3, -3, 0x19A, 0x19A, 163, 0, 0x19C, 0x19C, 0, 211, 0x19D, 0x19D, 0, 213, 0x19E, 0x19E, 130, 0, 0x19F, 0x19F, 0, 214, 0x1A0, 0x1A5, -3, -3, 0x1A6, 0x1A6, 0, 218, 0x1A7, 0x1A8, -3, -3, 0x1A9, 0x1A9, 0, 218, 0x1AC, 0x1AD, -3, -3, 0x1AE, 0x1AE, 0, 218, 0x1AF, 0x1B0, -3, -3, 0x1B1, 0x1B2, 0, 217, 0x1B3, 0x1B6, -3, -3, 0x1B7, 0x1B7, 0, 219, 0x1B8, 0x1B9, -3, -3, 0x1BC, 0x1BD, -3, -3, 0x1BF, 0x1BF, 56, 0, 0x1C4, 0x1CC, -2, -2, 0x1CD, 0x1DC, -3, -3, 0x1DD, 0x1DD, -79, 0, 0x1DE, 0x1EF, -3, -3, 0x1F1, 0x1F3, -2, -2, 0x1F4, 0x1F5, -3, -3, 0x1F6, 0x1F6, 0, -97, 0x1F7, 0x1F7, 0, -56, 0x1F8, 0x21F, -3, -3, 0x220, 0x220, 0, -130, 0x222, 0x233, -3, -3, 0x23A, 0x23A, 0, 10795, 0x23B, 0x23C, -3, -3, 0x23D, 0x23D, 0, -163, 0x23E, 0x23E, 0, 10792, 0x23F, 0x240, 10815, 0, 0x241, 0x242, -3, -3, 0x243, 0x243, 0, -195, 0x244, 0x244, 0, 69, 0x245, 0x245, 0, 71, 0x246, 0x24F, -3, -3, 0x250, 0x250, 10783, 0, 0x251, 0x251, 10780, 0, 0x252, 0x252, 10782, 0, 0x253, 0x253, -210, 0, 0x254, 0x254, -206, 0, 0x256, 0x257, -205, 0, 0x259, 0x259, -202, 0, 0x25B, 0x25B, -203, 0, 0x25C, 0x25C, 42319, 0, 0x260, 0x260, -205, 0, 0x261, 0x261, 42315, 0, 0x263, 0x263, -207, 0, 0x265, 0x265, 42280, 0, 0x266, 0x266, 42308, 0, 0x268, 0x268, -209, 0, 0x269, 0x269, -211, 0, 0x26A, 0x26A, 42308, 0, 0x26B, 0x26B, 10743, 0, 0x26C, 0x26C, 42305, 0, 0x26F, 0x26F, -211, 0, 0x271, 0x271, 10749, 0, 0x272, 0x272, -213, 0, 0x275, 0x275, -214, 0, 0x27D, 0x27D, 10727, 0, 0x280, 0x280, -218, 0, 0x282, 0x282, 42307, 0, 0x283, 0x283, -218, 0, 0x287, 0x287, 42282, 0, 0x288, 0x288, -218, 0, 0x289, 0x289, -69, 0, 0x28A, 0x28B, -217, 0, 0x28C, 0x28C, -71, 0, 0x292, 0x292, -219, 0, 0x29D, 0x29D, 42261, 0, 0x29E, 0x29E, 42258, 0, 0x345, 0x345, 84, 0, 0x370, 0x373, -3, -3, 0x376, 0x377, -3, -3, 0x37B, 0x37D, 130, 0, 0x37F, 0x37F, 0, 116, 0x386, 0x386, 0, 38, 0x388, 0x38A, 0, 37, 0x38C, 0x38C, 0, 64, 0x38E, 0x38F, 0, 63, 0x391, 0x3A1, 0, 32, 0x3A3, 0x3AB, 0, 32, 0x3AC, 0x3AC, -38, 0, 0x3AD, 0x3AF, -37, 0, 0x3B1, 0x3C1, -32, 0, 0x3C2, 0x3C2, -31, 0, 0x3C3, 0x3CB, -32, 0, 0x3CC, 0x3CC, -64, 0, 0x3CD, 0x3CE, -63, 0, 0x3CF, 0x3CF, 0, 8, 0x3D0, 0x3D0, -62, 0, 0x3D1, 0x3D1, -57, 0, 0x3D5, 0x3D5, -47, 0, 0x3D6, 0x3D6, -54, 0, 0x3D7, 0x3D7, -8, 0, 0x3D8, 0x3EF, -3, -3, 0x3F0, 0x3F0, -86, 0, 0x3F1, 0x3F1, -80, 0, 0x3F2, 0x3F2, 7, 0, 0x3F3, 0x3F3, -116, 0, 0x3F4, 0x3F4, 0, -60, 0x3F5, 0x3F5, -96, 0, 0x3F7, 0x3F8, -3, -3, 0x3F9, 0x3F9, 0, -7, 0x3FA, 0x3FB, -3, -3, 0x3FD, 0x3FF, 0, -130, 0x400, 0x40F, 0, 80, 0x410, 0x42F, 0, 32, 0x430, 0x44F, -32, 0, 0x450, 0x45F, -80, 0, 0x460, 0x481, -3, -3, 0x48A, 0x4BF, -3, -3, 0x4C0, 0x4C0, 0, 15, 0x4C1, 0x4CE, -3, -3, 0x4CF, 0x4CF, -15, 0, 0x4D0, 0x52F, -3, -3, 0x531, 0x556, 0, 48, 0x561, 0x586, -48, 0, 0x10A0, 0x10C5, 0, 7264, 0x10C7, 0x10C7, 0, 7264, 0x10CD, 0x10CD, 0, 7264, 0x10D0, 0x10FA, 3008, 0, 0x10FD, 0x10FF, 3008, 0, 0x13A0, 0x13EF, 0, 38864, 0x13F0, 0x13F5, 0, 8, 0x13F8, 0x13FD, -8, 0, 0x1C80, 0x1C80, -6254, 0, 0x1C81, 0x1C81, -6253, 0, 0x1C82, 0x1C82, -6244, 0, 0x1C83, 0x1C84, -6242, 0, 0x1C85, 0x1C85, -6243, 0, 0x1C86, 0x1C86, -6236, 0, 0x1C87, 0x1C87, -6181, 0, 0x1C88, 0x1C88, 35266, 0, 0x1C90, 0x1CBA, 0, -3008, 0x1CBD, 0x1CBF, 0, -3008, 0x1D79, 0x1D79, 35332, 0, 0x1D7D, 0x1D7D, 3814, 0, 0x1D8E, 0x1D8E, 35384, 0, 0x1E00, 0x1E95, -3, -3, 0x1E9B, 0x1E9B, -59, 0, 0x1E9E, 0x1E9E, 0, -7615, 0x1EA0, 0x1EFF, -3, -3, 0x1F00, 0x1F07, 8, 0, 0x1F08, 0x1F0F, 0, -8, 0x1F10, 0x1F15, 8, 0, 0x1F18, 0x1F1D, 0, -8, 0x1F20, 0x1F27, 8, 0, 0x1F28, 0x1F2F, 0, -8, 0x1F30, 0x1F37, 8, 0, 0x1F38, 0x1F3F, 0, -8, 0x1F40, 0x1F45, 8, 0, 0x1F48, 0x1F4D, 0, -8, 0x1F51, 0x1F51, 8, 0, 0x1F53, 0x1F53, 8, 0, 0x1F55, 0x1F55, 8, 0, 0x1F57, 0x1F57, 8, 0, 0x1F59, 0x1F59, 0, -8, 0x1F5B, 0x1F5B, 0, -8, 0x1F5D, 0x1F5D, 0, -8, 0x1F5F, 0x1F5F, 0, -8, 0x1F60, 0x1F67, 8, 0, 0x1F68, 0x1F6F, 0, -8, 0x1F70, 0x1F71, 74, 0, 0x1F72, 0x1F75, 86, 0, 0x1F76, 0x1F77, 100, 0, 0x1F78, 0x1F79, 128, 0, 0x1F7A, 0x1F7B, 112, 0, 0x1F7C, 0x1F7D, 126, 0, 0x1F80, 0x1F87, 8, 0, 0x1F88, 0x1F8F, 0, -8, 0x1F90, 0x1F97, 8, 0, 0x1F98, 0x1F9F, 0, -8, 0x1FA0, 0x1FA7, 8, 0, 0x1FA8, 0x1FAF, 0, -8, 0x1FB0, 0x1FB1, 8, 0, 0x1FB3, 0x1FB3, 9, 0, 0x1FB8, 0x1FB9, 0, -8, 0x1FBA, 0x1FBB, 0, -74, 0x1FBC, 0x1FBC, 0, -9, 0x1FBE, 0x1FBE, -7205, 0, 0x1FC3, 0x1FC3, 9, 0, 0x1FC8, 0x1FCB, 0, -86, 0x1FCC, 0x1FCC, 0, -9, 0x1FD0, 0x1FD1, 8, 0, 0x1FD8, 0x1FD9, 0, -8, 0x1FDA, 0x1FDB, 0, -100, 0x1FE0, 0x1FE1, 8, 0, 0x1FE5, 0x1FE5, 7, 0, 0x1FE8, 0x1FE9, 0, -8, 0x1FEA, 0x1FEB, 0, -112, 0x1FEC, 0x1FEC, 0, -7, 0x1FF3, 0x1FF3, 9, 0, 0x1FF8, 0x1FF9, 0, -128, 0x1FFA, 0x1FFB, 0, -126, 0x1FFC, 0x1FFC, 0, -9, 0x2126, 0x2126, 0, -7517, 0x212A, 0x212A, 0, -8383, 0x212B, 0x212B, 0, -8262, 0x2132, 0x2132, 0, 28, 0x214E, 0x214E, -28, 0, 0x2160, 0x216F, 0, 16, 0x2170, 0x217F, -16, 0, 0x2183, 0x2184, -3, -3, 0x24B6, 0x24CF, 0, 26, 0x24D0, 0x24E9, -26, 0, 0x2C00, 0x2C2F, 0, 48, 0x2C30, 0x2C5F, -48, 0, 0x2C60, 0x2C61, -3, -3, 0x2C62, 0x2C62, 0, -10743, 0x2C63, 0x2C63, 0, -3814, 0x2C64, 0x2C64, 0, -10727, 0x2C65, 0x2C65, -10795, 0, 0x2C66, 0x2C66, -10792, 0, 0x2C67, 0x2C6C, -3, -3, 0x2C6D, 0x2C6D, 0, -10780, 0x2C6E, 0x2C6E, 0, -10749, 0x2C6F, 0x2C6F, 0, -10783, 0x2C70, 0x2C70, 0, -10782, 0x2C72, 0x2C73, -3, -3, 0x2C75, 0x2C76, -3, -3, 0x2C7E, 0x2C7F, 0, -10815, 0x2C80, 0x2CE3, -3, -3, 0x2CEB, 0x2CEE, -3, -3, 0x2CF2, 0x2CF3, -3, -3, 0x2D00, 0x2D25, -7264, 0, 0x2D27, 0x2D27, -7264, 0, 0x2D2D, 0x2D2D, -7264, 0, 0xA640, 0xA66D, -3, -3, 0xA680, 0xA69B, -3, -3, 0xA722, 0xA72F, -3, -3, 0xA732, 0xA76F, -3, -3, 0xA779, 0xA77C, -3, -3, 0xA77D, 0xA77D, 0, -35332, 0xA77E, 0xA787, -3, -3, 0xA78B, 0xA78C, -3, -3, 0xA78D, 0xA78D, 0, -42280, 0xA790, 0xA793, -3, -3, 0xA794, 0xA794, 48, 0, 0xA796, 0xA7A9, -3, -3, 0xA7AA, 0xA7AA, 0, -42308, 0xA7AB, 0xA7AB, 0, -42319, 0xA7AC, 0xA7AC, 0, -42315, 0xA7AD, 0xA7AD, 0, -42305, 0xA7AE, 0xA7AE, 0, -42308, 0xA7B0, 0xA7B0, 0, -42258, 0xA7B1, 0xA7B1, 0, -42282, 0xA7B2, 0xA7B2, 0, -42261, 0xA7B3, 0xA7B3, 0, 928, 0xA7B4, 0xA7C3, -3, -3, 0xA7C4, 0xA7C4, 0, -48, 0xA7C5, 0xA7C5, 0, -42307, 0xA7C6, 0xA7C6, 0, -35384, 0xA7C7, 0xA7CA, -3, -3, 0xA7D0, 0xA7D1, -3, -3, 0xA7D6, 0xA7D9, -3, -3, 0xA7F5, 0xA7F6, -3, -3, 0xAB53, 0xAB53, -928, 0, 0xAB70, 0xABBF, -38864, 0, 0xFF21, 0xFF3A, 0, 32, 0xFF41, 0xFF5A, -32, 0, 0x10400, 0x10427, 0, 40, 0x10428, 0x1044F, -40, 0, 0x104B0, 0x104D3, 0, 40, 0x104D8, 0x104FB, -40, 0, 0x10570, 0x1057A, 0, 39, 0x1057C, 0x1058A, 0, 39, 0x1058C, 0x10592, 0, 39, 0x10594, 0x10595, 0, 39, 0x10597, 0x105A1, -39, 0, 0x105A3, 0x105B1, -39, 0, 0x105B3, 0x105B9, -39, 0, 0x105BB, 0x105BC, -39, 0, 0x10C80, 0x10CB2, 0, 64, 0x10CC0, 0x10CF2, -64, 0, 0x118A0, 0x118BF, 0, 32, 0x118C0, 0x118DF, -32, 0, 0x16E40, 0x16E5F, 0, 32, 0x16E60, 0x16E7F, -32, 0, 0x1E900, 0x1E921, 0, 34, 0x1E922, 0x1E943, -34, 0}; // fixed array const static const u8 _const_str_intp_has_dynamic_width = 1; // precomputed2 static const u8 _const_str_intp_has_dynamic_precision = 2; // precomputed2 static rune _const_utf8_replacement_rune; // inited later static const f64 _const_math__internal__f64_epsilon = 2.220446049250313e-16; // precomputed2 static const f64 _const_math__internal__sqrt_f64_epsilon = 1.4901161193847656e-08; // precomputed2 static const f64 _const_math__internal__root3_f64_epsilon = 6.055454452393343e-06; // precomputed2 static const f64 _const_math__internal__root4_f64_epsilon = 0.0001220703125; // precomputed2 static const f64 _const_math__internal__root5_f64_epsilon = 0.000740095979741405; // precomputed2 static const f64 _const_math__internal__root6_f64_epsilon = 0.002460783300575925; // precomputed2 static const f64 _const_math__internal__log_f64_epsilon = -36.04365338911715; // precomputed2 static const f64 _const_math__internal__f64_min = 2.2250738585072014e-308; // precomputed2 static const f64 _const_math__internal__sqrt_f64_min = 1.4916681462400413e-154; // precomputed2 static const f64 _const_math__internal__root3_f64_min = 2.8126442852362996e-103; // precomputed2 static const f64 _const_math__internal__root4_f64_min = 1.221338669755462e-77; // precomputed2 static const f64 _const_math__internal__root5_f64_min = 2.9476022969691763e-62; // precomputed2 static const f64 _const_math__internal__root6_f64_min = 5.303436890579822e-52; // precomputed2 static const f64 _const_math__internal__log_f64_min = -708.3964185322641; // precomputed2 static const f64 _const_math__internal__f64_max = 1.7976931348623157e+308; // precomputed2 static const f64 _const_math__internal__sqrt_f64_max = 1.3407807929942596e+154; // precomputed2 static const f64 _const_math__internal__root3_f64_max = 5.64380309412229e+102; // precomputed2 static const f64 _const_math__internal__root4_f64_max = 1.157920892373162e+77; // precomputed2 static const f64 _const_math__internal__root5_f64_max = 4.4765466227572707e+61; // precomputed2 static const f64 _const_math__internal__root6_f64_max = 2.3756689782295612e+51; // precomputed2 static const f64 _const_math__internal__log_f64_max = 709.782712893384; // precomputed2 static const f64 _const_math__internal__f32_epsilon = 1.1920928955078125e-07; // precomputed2 static const f64 _const_math__internal__sqrt_f32_epsilon = 0.00034526698300124393; // precomputed2 static const f64 _const_math__internal__root3_f32_epsilon = 0.00492156660115185; // precomputed2 static const f64 _const_math__internal__root4_f32_epsilon = 0.018581361171917516; // precomputed2 static const f64 _const_math__internal__root5_f32_epsilon = 0.04123462221165294; // precomputed2 static const f64 _const_math__internal__root6_f32_epsilon = 0.07015387801933583; // precomputed2 static const f64 _const_math__internal__log_f32_epsilon = -15.942385152878742; // precomputed2 static const f64 _const_math__internal__f32_min = 1.1754943508222875e-38; // precomputed2 static const f64 _const_math__internal__sqrt_f32_min = 1.0842021724855044e-19; // precomputed2 static const f64 _const_math__internal__root3_f32_min = 2.273736754432324e-13; // precomputed2 static const f64 _const_math__internal__root4_f32_min = 3.2927225399135965e-10; // precomputed2 static const f64 _const_math__internal__root5_f32_min = 2.5944428542140822e-08; // precomputed2 static const f64 _const_math__internal__root6_f32_min = 4.768371582031254e-07; // precomputed2 static const f64 _const_math__internal__log_f32_min = -87.3365447505531; // precomputed2 static const f64 _const_math__internal__f32_max = 3.4028234663852886e+38; // precomputed2 static const f64 _const_math__internal__sqrt_f32_max = 1.844674352395373e+19; // precomputed2 static const f64 _const_math__internal__root3_f32_max = 6.981463519622324e+12; // precomputed2 static const f64 _const_math__internal__root4_f32_max = 4.2949672319999986e+09; // precomputed2 static const f64 _const_math__internal__root5_f32_max = 5.085900785596004e+07; // precomputed2 static const f64 _const_math__internal__root6_f32_max = 2.642245923380775e+06; // precomputed2 static const f64 _const_math__internal__log_f32_max = 88.72283905206835; // precomputed2 static const f64 _const_math__internal__sflt_epsilon = 0.00048828125; // precomputed2 static const f64 _const_math__internal__sqrt_sflt_epsilon = 0.02209708691207961; // precomputed2 static const f64 _const_math__internal__root3_sflt_epsilon = 0.07874506561842959; // precomputed2 static const f64 _const_math__internal__root4_sflt_epsilon = 0.14865088937534013; // precomputed2 static const f64 _const_math__internal__root5_sflt_epsilon = 0.217637640824031; // precomputed2 static const f64 _const_math__internal__root6_sflt_epsilon = 0.28061551207734325; // precomputed2 static const f64 _const_math__internal__log_sflt_epsilon = -7.6246189861593985; // precomputed2 static const f64 _const_math__internal__max_f64_fact_arg = 171.0; // precomputed2 static const f64 _const_math__internal__max_long_f64_fact_arg = 1755.5; // precomputed2 static const u64 _const_math__uvnan = 9221120237041090561U; // precomputed2 static const u64 _const_math__uvinf = 9218868437227405312U; // precomputed2 static const u64 _const_math__uvneginf = 18442240474082181120U; // precomputed2 static const u64 _const_math__uvone = 4607182418800017408U; // precomputed2 static const u64 _const_math__normalize_smallest_mask = 4503599627370496U; // precomputed2 static const u64 _const_math__sign_mask = 9223372036854775808U; // precomputed2 static const u64 _const_math__frac_mask = 4503599627370495U; // precomputed2 static const f64 _const_math__epsilon = 2.220446049250313e-16; // precomputed2 static const f64 _const_math__e = 2.718281828459045; // precomputed2 static const f64 _const_math__pi = 3.141592653589793; // precomputed2 static const f64 _const_math__phi = 1.618033988749895; // precomputed2 static const f64 _const_math__tau = 6.283185307179586; // precomputed2 static const f64 _const_math__sqrt2 = 1.4142135623730951; // precomputed2 static const f64 _const_math__sqrt_3 = 1.7320508075688772; // precomputed2 static const f64 _const_math__sqrt_5 = 2.23606797749979; // precomputed2 static const f64 _const_math__sqrt_e = 1.6487212707001282; // precomputed2 static const f64 _const_math__sqrt_pi = 1.772453850905516; // precomputed2 static const f64 _const_math__sqrt_tau = 2.5066282746310007; // precomputed2 static const f64 _const_math__sqrt_phi = 1.272019649514069; // precomputed2 static const f64 _const_math__ln2 = 0.6931471805599453; // precomputed2 static const f64 _const_math__ln10 = 2.302585092994046; // precomputed2 static const f64 _const_math__two_thirds = 0.6666666666666666; // precomputed2 static const f64 _const_math__max_f32 = 3.4028234663852886e+38; // precomputed2 static const f64 _const_math__smallest_non_zero_f32 = 1.401298464324817e-45; // precomputed2 static const f64 _const_math__max_f64 = 1.7976931348623157e+308; // precomputed2 static const f64 _const_math__smallest_non_zero_f64 = 0.0; // precomputed2 static const f64 _const_math__erx = 0.8450629115104675; // precomputed2 static const f64 _const_math__efx = 0.1283791670955126; // precomputed2 static const f64 _const_math__efx8 = 1.0270333367641007; // precomputed2 static const f64 _const_math__pp0 = 0.12837916709551256; // precomputed2 static const f64 _const_math__pp1 = -0.3250421072470015; // precomputed2 static const f64 _const_math__pp2 = -0.02848174957559851; // precomputed2 static const f64 _const_math__pp3 = -0.005770270296489442; // precomputed2 static const f64 _const_math__pp4 = -2.3763016656650163e-05; // precomputed2 static const f64 _const_math__qq1 = 0.39791722395915535; // precomputed2 static const f64 _const_math__qq2 = 0.0650222499887673; // precomputed2 static const f64 _const_math__qq3 = 0.005081306281875766; // precomputed2 static const f64 _const_math__qq4 = 0.00013249473800432164; // precomputed2 static const f64 _const_math__qq5 = -3.960228278775368e-06; // precomputed2 static const f64 _const_math__pa0 = -0.0023621185607526594; // precomputed2 static const f64 _const_math__pa1 = 0.41485611868374833; // precomputed2 static const f64 _const_math__pa2 = -0.3722078760357013; // precomputed2 static const f64 _const_math__pa3 = 0.31834661990116175; // precomputed2 static const f64 _const_math__pa4 = -0.11089469428239668; // precomputed2 static const f64 _const_math__pa5 = 0.035478304325618236; // precomputed2 static const f64 _const_math__pa6 = -0.002166375594868791; // precomputed2 static const f64 _const_math__qa1 = 0.10642088040084423; // precomputed2 static const f64 _const_math__qa2 = 0.540397917702171; // precomputed2 static const f64 _const_math__qa3 = 0.07182865441419627; // precomputed2 static const f64 _const_math__qa4 = 0.12617121980876164; // precomputed2 static const f64 _const_math__qa5 = 0.01363708391202905; // precomputed2 static const f64 _const_math__qa6 = 0.011984499846799107; // precomputed2 static const f64 _const_math__ra0 = -0.009864944034847148; // precomputed2 static const f64 _const_math__ra1 = -0.6938585727071818; // precomputed2 static const f64 _const_math__ra2 = -10.558626225323291; // precomputed2 static const f64 _const_math__ra3 = -62.375332450326006; // precomputed2 static const f64 _const_math__ra4 = -162.39666946257347; // precomputed2 static const f64 _const_math__ra5 = -184.60509290671104; // precomputed2 static const f64 _const_math__ra6 = -81.2874355063066; // precomputed2 static const f64 _const_math__ra7 = -9.814329344169145; // precomputed2 static const f64 _const_math__sa1 = 19.651271667439257; // precomputed2 static const f64 _const_math__sa2 = 137.65775414351904; // precomputed2 static const f64 _const_math__sa3 = 434.56587747522923; // precomputed2 static const f64 _const_math__sa4 = 645.3872717332679; // precomputed2 static const f64 _const_math__sa5 = 429.00814002756783; // precomputed2 static const f64 _const_math__sa6 = 108.63500554177944; // precomputed2 static const f64 _const_math__sa7 = 6.570249770319282; // precomputed2 static const f64 _const_math__sa8 = -0.0604244152148581; // precomputed2 static const f64 _const_math__rb0 = -0.0098649429247001; // precomputed2 static const f64 _const_math__rb1 = -0.799283237680523; // precomputed2 static const f64 _const_math__rb2 = -17.757954917754752; // precomputed2 static const f64 _const_math__rb3 = -160.63638485582192; // precomputed2 static const f64 _const_math__rb4 = -637.5664433683896; // precomputed2 static const f64 _const_math__rb5 = -1025.0951316110772; // precomputed2 static const f64 _const_math__rb6 = -483.5191916086514; // precomputed2 static const f64 _const_math__sb1 = 30.33806074348246; // precomputed2 static const f64 _const_math__sb2 = 325.7925129965739; // precomputed2 static const f64 _const_math__sb3 = 1536.729586084437; // precomputed2 static const f64 _const_math__sb4 = 3199.8582195085955; // precomputed2 static const f64 _const_math__sb5 = 2553.0504064331644; // precomputed2 static const f64 _const_math__sb6 = 474.52854120695537; // precomputed2 static const f64 _const_math__sb7 = -22.44095244658582; // precomputed2 static const f64 _const_math__ln2hi = 0.6931471803691238; // precomputed2 static const f64 _const_math__ln2lo = 1.9082149292705877e-10; // precomputed2 static const f64 _const_math__log_sqrt_2pi = 0.9189385332046728; // precomputed2 static Array_f64 _const_math__bernoulli; // inited later static Array_f64 _const_math__factorials_table; // inited later static Array_f64 _const_math__log_factorials_table; // inited later static Array_f64 _const_math__gamma_p; // inited later static Array_f64 _const_math__gamma_q; // inited later static Array_f64 _const_math__gamma_s; // inited later static Array_f64 _const_math__lgamma_a; // inited later static Array_f64 _const_math__lgamma_r; // inited later static Array_f64 _const_math__lgamma_s; // inited later static Array_f64 _const_math__lgamma_t; // inited later static Array_f64 _const_math__lgamma_u; // inited later static Array_f64 _const_math__lgamma_v; // inited later static Array_f64 _const_math__lgamma_w; // inited later static const f64 _const_math__morebits = 6.123233995736766e-17; // precomputed2 static const f64 _const_math__tan3pio8 = 2.414213562373095; // precomputed2 static const f64 _const_math__two54 = 1.8014398509481984e+16; // precomputed2 static const f64 _const_math__ivln10 = 0.4342944819032518; // precomputed2 static const f64 _const_math__log10_2hi = 0.30102999566361177; // precomputed2 static const f64 _const_math__log10_2lo = 3.694239077158931e-13; // precomputed2 static const f64 _const_math__modf_maxpowtwo = 4.503599627370496e+15; // precomputed2 static Array_f64 _const_math__pow10tab; // inited later static Array_f64 _const_math__pow10postab32; // inited later static Array_f64 _const_math__pow10negtab32; // inited later static Array_f64 _const_math__sin_data; // inited later static Array_f64 _const_math__cos_data; // inited later static Array_f64 _const_math__tan_p; // inited later static Array_f64 _const_math__tan_q; // inited later static const f64 _const_math__tan_dp1 = 0.7853981554508209; // precomputed2 static const f64 _const_math__tan_dp2 = 7.946627356147928e-09; // precomputed2 static const f64 _const_math__tan_dp3 = 3.061616997868383e-17; // precomputed2 static const f64 _const_math__tan_lossth = 1.073741824e+09; // precomputed2 static Array_f64 _const_math__tanh_p; // inited later static Array_f64 _const_math__tanh_q; // inited later static u32 _const_builtin__closure__closure_size_1; // inited later Array_fixed_int_64 g_autostr_type_stack = {0}; // global 6 Array_fixed_voidptr_64 g_autostr_addr_stack = {0}; // global 6 static math__ChebSeries _const_math__sin_cs; // inited later static math__ChebSeries _const_math__cos_cs; // inited later static int _const_builtin__closure__closure_size; // inited later // V interface table: static IError I_None___to_Interface_IError(None__* x); enum { _IError_None___index = 1 }; static IError I_voidptr_to_Interface_IError(voidptr* x); enum { _IError_voidptr_index = 2 }; static IError I_MessageError_to_Interface_IError(MessageError* x); enum { _IError_MessageError_index = 3 }; static IError I_Error_to_Interface_IError(Error* x); enum { _IError_Error_index = 4 }; // ^^^ number of types for interface IError: 4 // Methods wrapper for interface "IError" static inline int builtin__None___code_Interface_IError_method_wrapper(None__* err) { return builtin__Error_code(err->Error); } static inline int builtin__None___code_Interface_IError_method_adapter(void* _x) { return builtin__None___code_Interface_IError_method_wrapper((None__*)_x); } static inline string builtin__None___msg_Interface_IError_method_wrapper(None__* err) { return builtin__Error_msg(err->Error); } static inline string builtin__None___msg_Interface_IError_method_adapter(void* _x) { return builtin__None___msg_Interface_IError_method_wrapper((None__*)_x); } static inline int builtin__MessageError_code_Interface_IError_method_wrapper(MessageError* err) { return builtin__MessageError_code(*err); } static inline int builtin__MessageError_code_Interface_IError_method_adapter(void* _x) { return builtin__MessageError_code_Interface_IError_method_wrapper((MessageError*)_x); } static inline string builtin__MessageError_msg_Interface_IError_method_wrapper(MessageError* err) { return builtin__MessageError_msg(*err); } static inline string builtin__MessageError_msg_Interface_IError_method_adapter(void* _x) { return builtin__MessageError_msg_Interface_IError_method_wrapper((MessageError*)_x); } static inline int builtin__Error_code_Interface_IError_method_wrapper(Error* err) { return builtin__Error_code(*err); } static inline int builtin__Error_code_Interface_IError_method_adapter(void* _x) { return builtin__Error_code_Interface_IError_method_wrapper((Error*)_x); } static inline string builtin__Error_msg_Interface_IError_method_wrapper(Error* err) { return builtin__Error_msg(*err); } static inline string builtin__Error_msg_Interface_IError_method_adapter(void* _x) { return builtin__Error_msg_Interface_IError_method_wrapper((Error*)_x); } struct _IError_interface_methods { int (*_method_code)(void* _); string (*_method_msg)(void* _); }; struct _IError_interface_methods IError_name_table[5] = { {0}, { ._method_code = builtin__None___code_Interface_IError_method_adapter, ._method_msg = builtin__None___msg_Interface_IError_method_adapter, }, { ._method_code = (void*) 0, ._method_msg = (void*) 0, }, { ._method_code = builtin__MessageError_code_Interface_IError_method_adapter, ._method_msg = builtin__MessageError_msg_Interface_IError_method_adapter, }, { ._method_code = builtin__Error_code_Interface_IError_method_adapter, ._method_msg = builtin__Error_msg_Interface_IError_method_adapter, }, }; // Casting functions for converting "None__" to interface "IError" static inline IError I_None___to_Interface_IError(None__* x) { return (IError) { ._None__ = x, ._typ = _IError_None___index, ._methods = &IError_name_table[_IError_None___index], }; } // Casting functions for converting "voidptr" to interface "IError" static inline IError I_voidptr_to_Interface_IError(voidptr* x) { return (IError) { ._voidptr = x, ._typ = _IError_voidptr_index, ._methods = &IError_name_table[_IError_voidptr_index], }; } // Casting functions for converting "MessageError" to interface "IError" static inline IError I_MessageError_to_Interface_IError(MessageError* x) { return (IError) { ._MessageError = x, ._typ = _IError_MessageError_index, ._methods = &IError_name_table[_IError_MessageError_index], }; } // Casting functions for converting "Error" to interface "IError" static inline IError I_Error_to_Interface_IError(Error* x) { return (IError) { ._Error = x, ._typ = _IError_Error_index, ._methods = &IError_name_table[_IError_Error_index], }; } static inline IError __v_interface_clone_variant__IError__None__(void* x) { return I_None___to_Interface_IError((None__*)builtin__memdup(x, sizeof(None__))); } static inline IError __v_interface_clone_variant__IError__voidptr(void* x) { return I_voidptr_to_Interface_IError((voidptr*)builtin__memdup(x, sizeof(voidptr))); } static inline IError __v_interface_clone_variant__IError__MessageError(void* x) { return I_MessageError_to_Interface_IError((MessageError*)builtin__memdup(x, sizeof(MessageError))); } static inline IError __v_interface_clone_variant__IError__Error(void* x) { return I_Error_to_Interface_IError((Error*)builtin__memdup(x, sizeof(Error))); } static inline IError __v_interface_clone__IError(IError x) { if (x._object == 0) { return x; } if (x._typ == _IError_None___index) { return __v_interface_clone_variant__IError__None__(x._object); } if (x._typ == _IError_voidptr_index) { return __v_interface_clone_variant__IError__voidptr(x._object); } if (x._typ == _IError_MessageError_index) { return __v_interface_clone_variant__IError__MessageError(x._object); } if (x._typ == _IError_Error_index) { return __v_interface_clone_variant__IError__Error(x._object); } return x; } // V sort fn definitions: VV_LOC int compare_11734835982493514523_RepIndex_by_idx_expr_612e6964780a3c0a622e696478(RepIndex* a, RepIndex* b) { if (a->idx < b->idx) return -1; if (b->idx < a->idx) return 1; return 0; } VV_LOC int compare_11734835982493514523_RepIndex_by_idx_expr_612e6964780a3c0a622e696478_qsort_adapter(const void* a, const void* b) { return compare_11734835982493514523_RepIndex_by_idx_expr_612e6964780a3c0a622e696478((RepIndex*)a, (RepIndex*)b); } VV_LOC int builtin__compare_lower_strings_qsort_adapter(const void* a, const void* b) { return builtin__compare_lower_strings((string*)a, (string*)b); } VV_LOC int builtin__compare_strings_by_len_qsort_adapter(const void* a, const void* b) { return builtin__compare_strings_by_len((string*)a, (string*)b); } static inline u64 VSAFE_DIV_u64(u64 x, u64 y) { if (_unlikely_(0 == y)) { builtin___v_panic(_S("division by zero")); } return x / y; } static inline u64 VSAFE_MOD_u64(u64 x, u64 y) { if (_unlikely_(0 == y)) { builtin___v_panic(_S("modulo by zero")); } return x % y; } static inline int VSAFE_DIV_int(int x, int y) { if (_unlikely_(0 == y)) { builtin___v_panic(_S("division by zero")); } return x / y; } static inline usize VSAFE_MOD_usize(usize x, usize y) { if (_unlikely_(0 == y)) { builtin___v_panic(_S("modulo by zero")); } return x % y; } static inline u32 VSAFE_DIV_u32(u32 x, u32 y) { if (_unlikely_(0 == y)) { builtin___v_panic(_S("division by zero")); } return x / y; } static inline u32 VSAFE_MOD_u32(u32 x, u32 y) { if (_unlikely_(0 == y)) { builtin___v_panic(_S("modulo by zero")); } return x % y; } static inline i64 VSAFE_DIV_i64(i64 x, i64 y) { if (_unlikely_(0 == y)) { builtin___v_panic(_S("division by zero")); } return x / y; } static inline int VSAFE_MOD_int(int x, int y) { if (_unlikely_(0 == y)) { builtin___v_panic(_S("modulo by zero")); } return x % y; } static inline i64 VSAFE_MOD_i64(i64 x, i64 y) { if (_unlikely_(0 == y)) { builtin___v_panic(_S("modulo by zero")); } return x % y; } static inline rune VSAFE_MOD_rune(rune x, rune y) { if (_unlikely_(0 == y)) { builtin___v_panic(_S("modulo by zero")); } return x % y; } // end of V out (header) // V auto functions: static bool Array_u8_contains(Array_u8 a, u8 v) { for (int i = 0; i < a.len; ++i) { if (((u8*)a.data)[i] == v) { return true; } } return false; } static inline bool Array_rune_arr_eq(Array_rune a, Array_rune b) { if (a.len != b.len) { return false; } for (int i = 0; i < a.len; ++i) { if (*((rune*)((byte*)a.data+(i*a.element_size))) != *((rune*)((byte*)b.data+(i*b.element_size)))) { return false; } } return true; } static inline bool builtin__closure__ClosureLifetimeRecord_struct_eq(builtin__closure__ClosureLifetimeRecord a, builtin__closure__ClosureLifetimeRecord b) { return a.exec_ptr == b.exec_ptr && a.generation == b.generation; } static inline bool Array_builtin__closure__ClosureLifetimeRecord_arr_eq(Array_builtin__closure__ClosureLifetimeRecord a, Array_builtin__closure__ClosureLifetimeRecord b) { if (a.len != b.len) { return false; } for (int i = 0; i < a.len; ++i) { if (!builtin__closure__ClosureLifetimeRecord_struct_eq(((builtin__closure__ClosureLifetimeRecord*)a.data)[i], ((builtin__closure__ClosureLifetimeRecord*)b.data)[i])) { return false; } } return true; } static inline bool builtin__closure__ClosureLifetimeFrame_struct_eq(builtin__closure__ClosureLifetimeFrame a, builtin__closure__ClosureLifetimeFrame b) { return a.start == b.start && a.end == b.end; } static inline bool Array_builtin__closure__ClosureLifetimeFrame_arr_eq(Array_builtin__closure__ClosureLifetimeFrame a, Array_builtin__closure__ClosureLifetimeFrame b) { if (a.len != b.len) { return false; } for (int i = 0; i < a.len; ++i) { if (!builtin__closure__ClosureLifetimeFrame_struct_eq(((builtin__closure__ClosureLifetimeFrame*)a.data)[i], ((builtin__closure__ClosureLifetimeFrame*)b.data)[i])) { return false; } } return true; } static inline bool builtin__closure__ClosureLifetimeState_struct_eq(builtin__closure__ClosureLifetimeState a, builtin__closure__ClosureLifetimeState b) { return a.owner_thread == b.owner_thread && a.active == b.active && a.disposed == b.disposed && a.suspended == b.suspended && a.frame_start == b.frame_start && a.frame_gen == b.frame_gen && a.generation == b.generation && a.frame_generation == b.frame_generation && Array_builtin__closure__ClosureLifetimeRecord_arr_eq(a.records, b.records) && Array_builtin__closure__ClosureLifetimeFrame_arr_eq(a.frames, b.frames) && a.next_free == b.next_free; } // >> typeof() support for sum types / interfaces static char * v_typeof_interface_IError(u32 sidx) { if (sidx == _IError_None___index) return "None__"; if (sidx == _IError_voidptr_index) return "voidptr"; if (sidx == _IError_MessageError_index) return "MessageError"; if (sidx == _IError_Error_index) return "Error"; return "unknown IError"; } u32 v_typeof_interface_idx_IError(u32 sidx) { if (sidx == _IError_None___index) return 65; if (sidx == _IError_voidptr_index) return 2; if (sidx == _IError_MessageError_index) return 67; if (sidx == _IError_Error_index) return 66; return 30; } // << typeof() support for sum types strings__Builder strings__new_builder(int initial_size) { strings__Builder res = ((builtin____new_array_with_default(0, initial_size, sizeof(u8), 0))); builtin__ArrayFlags_set(&res.flags, ArrayFlags__noslices); return res; } Array_u8 strings__Builder_reuse_as_plain_u8_array(strings__Builder* b) { builtin__ArrayFlags_clear(&b->flags, ArrayFlags__noslices); return *b; } void strings__Builder_write_ptr(strings__Builder* b, u8* ptr, int len) { if (len == 0) { return; } builtin__array_push_many(b, ptr, len); } void strings__Builder_write_rune(strings__Builder* b, rune r) { Array_fixed_u8_5 buffer = {0}; string res = builtin__utf32_to_str_no_malloc(((u32)(r)), &buffer[0]); if (res.len == 0) { return; } builtin__array_push_many(b, res.str, res.len); } void strings__Builder_write_runes(strings__Builder* b, Array_rune runes) { Array_fixed_u8_5 buffer = {0}; for (int _t1 = 0; _t1 < runes.len; ++_t1) { rune r = ((rune*)runes.data)[_t1]; string res = builtin__utf32_to_str_no_malloc(((u32)(r)), &buffer[0]); if (res.len == 0) { continue; } builtin__array_push_many(b, res.str, res.len); } } inline void strings__Builder_write_u8(strings__Builder* b, u8 data) { builtin__array_push((array*)b, _MOV((u8[]){ data })); } inline void strings__Builder_write_byte(strings__Builder* b, u8 data) { builtin__array_push((array*)b, _MOV((u8[]){ data })); } void strings__Builder_write_decimal(strings__Builder* b, i64 n) { if (n == 0) { strings__Builder_write_u8(b, 0x30); return; } u64 mag = ((u64)(n)); if (n < 0) { strings__Builder_write_u8(b, '-'); mag = ((u64)(0)) - mag; } strings__Builder_write_u_decimal(b, mag); } void strings__Builder_write_u_decimal(strings__Builder* b, u64 n) { if (n == 0) { strings__Builder_write_u8(b, 0x30); return; } Array_fixed_u8_20 buf = {0}; u64 x = n; int i = 19; for (;;) { if (!(x != 0)) break; u64 nextx = VSAFE_DIV_u64(x , 10); u64 r = VSAFE_MOD_u64(x , 10); buf[i] = (u8)(((u8)(r)) + 0x30); x = nextx; i--; } strings__Builder_write_ptr(b, &buf[i + 1], 19 - i); } _result_int strings__Builder_write(strings__Builder* b, Array_u8 data) { if (data.len == 0) { _result_int _t1; builtin___result_ok(&(int[]) { 0 }, (_result*)(&_t1), sizeof(int)); return _t1; } builtin__array_push_many(b, data.data, data.len); _result_int _t2; builtin___result_ok(&(int[]) { data.len }, (_result*)(&_t2), sizeof(int)); return _t2; } void strings__Builder_drain_builder(strings__Builder* b, strings__Builder* other, int other_new_cap) { if (other->len > 0) { _PUSH_MANY(b, (*other), _t1, strings__Builder); } strings__Builder_free(other); *other = strings__new_builder(other_new_cap); } inline u8 strings__Builder_byte_at(strings__Builder* b, int n) { return (*(u8*)builtin__array_get(*(((Array_u8*)(b))), n)); } inline void strings__Builder_write_string(strings__Builder* b, string s) { if (s.len == 0) { return; } builtin__array_push_many(b, s.str, s.len); } inline void strings__Builder_write_string2(strings__Builder* b, string s1, string s2) { if (s1.len != 0) { builtin__array_push_many(b, s1.str, s1.len); } if (s2.len != 0) { builtin__array_push_many(b, s2.str, s2.len); } } void strings__Builder_go_back(strings__Builder* b, int n) { builtin__array_trim(b, b->len - n); } inline string strings__Builder_spart(strings__Builder* b, int start_pos, int n) { { // Unsafe block u8* x = builtin__malloc_noscan(n + 1); builtin__vmemcpy(x, ((u8*)(b->data)) + start_pos, n); x[n] = 0; return builtin__tos(x, n); } return (string){.str=(byteptr)"", .is_lit=1}; } string strings__Builder_cut_last(strings__Builder* b, int n) { int cut_pos = b->len - n; string res = strings__Builder_spart(b, cut_pos, n); builtin__array_trim(b, cut_pos); return res; } string strings__Builder_cut_to(strings__Builder* b, int pos) { if (pos > b->len) { return _S(""); } return strings__Builder_cut_last(b, b->len - pos); } void strings__Builder_go_back_to(strings__Builder* b, int pos) { builtin__array_trim(b, pos); } inline void strings__Builder_writeln(strings__Builder* b, string s) { if ((s).len != 0) { builtin__array_push_many(b, s.str, s.len); } builtin__array_push((array*)b, _MOV((u8[]){ ((u8)('\n')) })); } inline void strings__Builder_writeln2(strings__Builder* b, string s1, string s2) { if ((s1).len != 0) { builtin__array_push_many(b, s1.str, s1.len); } builtin__array_push((array*)b, _MOV((u8[]){ ((u8)('\n')) })); if ((s2).len != 0) { builtin__array_push_many(b, s2.str, s2.len); } builtin__array_push((array*)b, _MOV((u8[]){ ((u8)('\n')) })); } string strings__Builder_last_n(strings__Builder* b, int n) { if (n > b->len) { return _S(""); } return strings__Builder_spart(b, b->len - n, n); } string strings__Builder_after(strings__Builder* b, int n) { if (n >= b->len) { return _S(""); } return strings__Builder_spart(b, n, b->len - n); } string strings__Builder_str(strings__Builder* b) { builtin__array_push((array*)b, _MOV((u8[]){ ((u8)(0)) })); u8* bcopy = ((u8*)(builtin__memdup_noscan(b->data, b->len))); string s = builtin__u8_vstring_with_len(bcopy, b->len - 1); builtin__array_clear(b); return s; } void strings__Builder_ensure_cap(strings__Builder* b, int n) { Array_u8* arr = ((Array_u8*)(b)); builtin__array_ensure_cap(arr, n); } void strings__Builder_grow_len(strings__Builder* b, int n) { if (n <= 0) { return; } int new_len = b->len + n; strings__Builder_ensure_cap(b, new_len); { // Unsafe block b->len = new_len; } } void strings__Builder_free(strings__Builder* b) { if (b->data != 0) { Array_u8* arr = ((Array_u8*)(b)); builtin__array_free(arr); } } void strings__Builder_write_repeated_rune(strings__Builder* b, rune r, int count) { if (count <= 0) { return; } Array_fixed_u8_5 buffer = {0}; string res = builtin__utf32_to_str_no_malloc(((u32)(r)), &buffer[0]); if (res.len == 0) { return; } if (res.len == 1) { strings__Builder_ensure_cap(b, b->len + count); { // Unsafe block builtin__vmemset(((u8*)(b->data)) + b->len, buffer[0], count); b->len += count; } return; } else { int total_needed = count * res.len; strings__Builder_ensure_cap(b, b->len + total_needed); u8* dest = ((u8*)(b->data)) + b->len; for (int _t1 = 0; _t1 < count; ++_t1) { { // Unsafe block builtin__vmemcpy(dest, res.str, res.len); dest += res.len; } } { // Unsafe block b->len += total_needed; } } } void strings__Builder_indent(strings__Builder* b, string s, strings__IndentParam param) { if (s.len == 0) { return; } strings__IndentState state = strings__IndentState__normal; int indent_level = param.starting_level; rune string_char = '\0'; bool at_line_start = true; for (int i = 0; i < s.len; i++) { rune c = ((rune)(s.str[ i])); if (state == (strings__IndentState__normal)) { if (c == ('"') || c == ('\'')) { state = strings__IndentState__in_string; string_char = c; if (at_line_start) { strings__Builder_write_repeated_rune(b, param.indent_char, indent_level * param.indent_count); at_line_start = false; } strings__Builder_write_rune(b, c); } else if (c == (param.block_start)) { if (at_line_start) { strings__Builder_write_repeated_rune(b, param.indent_char, indent_level * param.indent_count); at_line_start = false; } strings__Builder_write_rune(b, c); if (i + 1 < s.len && s.str[ i + 1] == param.block_end) { strings__Builder_write_rune(b, param.block_end); i++; } else { indent_level++; strings__Builder_write_rune(b, '\n'); at_line_start = true; } } else if (c == (param.block_end)) { if (indent_level > 0) { indent_level--; } if (!at_line_start) { strings__Builder_write_rune(b, '\n'); } strings__Builder_write_repeated_rune(b, param.indent_char, indent_level * param.indent_count); at_line_start = false; strings__Builder_write_rune(b, c); } else if (c == (' ') || c == ('\t') || c == ('\r') || c == ('\n')) { if (!at_line_start) { strings__Builder_write_rune(b, c); } if (c == '\n') { at_line_start = true; } } else { if (at_line_start) { strings__Builder_write_repeated_rune(b, param.indent_char, indent_level * param.indent_count); at_line_start = false; } strings__Builder_write_rune(b, c); } } else if (state == (strings__IndentState__in_string)) { strings__Builder_write_rune(b, c); if (c == string_char) { if (s.str[ i - 1] != '\\') { state = strings__IndentState__normal; string_char = '\0'; } } } } } inline VV_LOC int strings__min(int a, int b, int c) { int m = a; if (b < m) { m = b; } if (c < m) { m = c; } return m; } inline VV_LOC int strings__max2(int a, int b) { if (a < b) { return b; } return a; } inline VV_LOC int strings__min2(int a, int b) { if (a < b) { return a; } return b; } inline VV_LOC int strings__abs2(int a, int b) { if (a < b) { return b - a; } return a - b; } int strings__levenshtein_distance(string a, string b) { if (a.len == 0) { return b.len; } if (b.len == 0) { return a.len; } if (builtin__string__eq(a, b)) { return 0; } Array_int row = builtin____new_array_with_default(a.len + 1, 0, sizeof(int), 0); { int* pelem = (int*)row.data; for (int index=0; index= b.len ? (a.len) : (b.len)); return (((f32)(1.00)) - ((f32)(d)) / ((f32)(l))) * ((f32)(100.00)); } f32 strings__dice_coefficient(string s1, string s2) { if (s1.len == 0 || s2.len == 0) { return 0.0; } if (builtin__string__eq(s1, s2)) { return 1.0; } if (s1.len < 2 || s2.len < 2) { return 0.0; } string a = (s1.len > s2.len ? (s1) : (s2)); string b = (builtin__string__eq(a, s1) ? (s2) : (s1)); Map_string_int first_bigrams = builtin__new_map(sizeof(string), sizeof(int), &builtin__map_hash_string, &builtin__map_eq_string, &builtin__map_clone_string, &builtin__map_free_string) ; for (int i = 0; i < a.len - 1; ++i) { string bigram = builtin__string_substr(a, i, i + 2); int q = (_IN_MAP(ADDR(string, bigram), ADDR(map, first_bigrams)) ? ((*(int*)builtin__map_get(ADDR(map, first_bigrams), &(string[]){bigram}, &(int[]){ 0 })) + 1) : (1)); builtin__map_set(&first_bigrams, &(string[]){bigram}, &(int[]) { q }); } int intersection_size = 0; for (int i = 0; i < b.len - 1; ++i) { string bigram = builtin__string_substr(b, i, i + 2); int count = (_IN_MAP(ADDR(string, bigram), ADDR(map, first_bigrams)) ? ((*(int*)builtin__map_get(ADDR(map, first_bigrams), &(string[]){bigram}, &(int[]){ 0 }))) : (0)); if (count > 0) { builtin__map_set(&first_bigrams, &(string[]){bigram}, &(int[]) { count - 1 }); intersection_size++; } } return (((f32)(2.0)) * ((f32)(intersection_size))) / (((f32)(a.len)) + ((f32)(b.len)) - 2); } int strings__hamming_distance(string a, string b) { if (a.len == 0 && b.len == 0) { return 0; } int match_len = strings__min2(a.len, b.len); int diff_count = strings__abs2(a.len, b.len); for (int i = 0; i < match_len; ++i) { if (a.str[ i] != b.str[ i]) { diff_count++; } } return diff_count; } f32 strings__hamming_similarity(string a, string b) { int l = strings__max2(a.len, b.len); if (l == 0) { return 1.0; } int d = strings__hamming_distance(a, b); return ((f32)(1.00)) - ((f32)(d)) / ((f32)(l)); } f64 strings__jaro_similarity(string a, string b) { int a_len = a.len; int b_len = b.len; if (a_len == 0 && b_len == 0) { return 1.0; } if (a_len == 0 || b_len == 0) { return 0; } int match_distance = strings__max2(VSAFE_DIV_int(strings__max2(a_len, b_len) , 2) - 1, 0); Array_bool a_matches = builtin____new_array_with_default(a_len, 0, sizeof(bool), 0); Array_bool b_matches = builtin____new_array_with_default(b_len, 0, sizeof(bool), 0); int matches = 0; f64 transpositions = 0.0; for (int i = 0; i < a_len; ++i) { int start = strings__max2(0, (int)(i - match_distance)); int end = strings__min2(b_len, (int)(i + match_distance) + 1); for (int k = start; k < end; ++k) { if (((bool*)b_matches.data)[k]) { continue; } if (a.str[ i] != b.str[ k]) { continue; } ((bool*)a_matches.data)[i] = true; ((bool*)b_matches.data)[k] = true; matches++; break; } } if (matches == 0) { return 0; } int k = 0; for (int i = 0; i < a_len; ++i) { if (!((bool*)a_matches.data)[i]) { continue; } for (;;) { if (!(!((bool*)b_matches.data)[k])) break; k++; } if (a.str[ i] != b.str[ k]) { transpositions++; } k++; } transpositions /= 2; return ((f64)(matches / ((f64)(a_len))) + (f64)(matches / ((f64)(b_len))) + (f64)(((f64)(matches - transpositions)) / matches)) / 3; } f64 strings__jaro_winkler_similarity(string a, string b) { int lmax = strings__min2(4, strings__min2(a.len, b.len)); int l = 0; for (int i = 0; i < lmax; ++i) { if (a.str[ i] == b.str[ i]) { l++; } } f64 js = strings__jaro_similarity(a, b); f64 p = 0.1; f64 ws = js + ((f64)(l)) * p * (1 - js); return ws; } string strings__repeat(u8 c, int n) { if (n <= 0) { return _S(""); } u8* bytes = builtin__malloc_noscan(n + 1); { // Unsafe block memset(bytes, c, n); bytes[n] = 0; } return builtin__u8_vstring_with_len(bytes, n); } string strings__repeat_string(string s, int n) { if (n <= 0 || s.len == 0) { return _S(""); } int slen = s.len; int blen = slen * n; u8* bytes = builtin__malloc_noscan(blen + 1); for (int bi = 0; bi < n; ++bi) { int bislen = (int)(bi * slen); for (int si = 0; si < slen; ++si) { { // Unsafe block bytes[(int)(bislen + si)] = s.str[ si]; } } } { // Unsafe block bytes[blen] = 0; } return builtin__u8_vstring_with_len(bytes, blen); } string strings__find_between_pair_u8(string input, u8 start, u8 end) { int marks = 0; int start_index = -1; for (int i = 0; i < input.len; ++i) { u8 b = input.str[i]; if (b == start) { if (start_index == -1) { start_index = i + 1; } marks++; continue; } if (start_index > 0) { if (b == end) { marks--; if (marks == 0) { return builtin__string_substr(input, start_index, i); } } } } return _S(""); } string strings__find_between_pair_rune(string input, rune start, rune end) { int marks = 0; int start_index = -1; Array_rune runes = builtin__string_runes(input); for (int i = 0; i < runes.len; ++i) { rune r = ((rune*)runes.data)[i]; if (r == start) { if (start_index == -1) { start_index = i + 1; } marks++; continue; } if (start_index > 0) { if (r == end) { marks--; if (marks == 0) { return Array_rune_string(builtin__array_slice(runes, start_index, i)); } } } } return _S(""); } string strings__find_between_pair_string(string input, string start, string end) { int start_index = -1; int marks = 0; Array_rune start_runes = builtin__string_runes(start); Array_rune end_runes = builtin__string_runes(end); Array_rune runes = builtin__string_runes(input); int i = 0; for (; i < runes.len; i++) { Array_rune start_slice = builtin__array_slice_ni(runes, i, i + start_runes.len); if (Array_rune_arr_eq(start_slice, start_runes)) { i = i + start_runes.len - 1; if (start_index < 0) { start_index = i + 1; } marks++; continue; } if (start_index > 0) { Array_rune end_slice = builtin__array_slice_ni(runes, i, i + end_runes.len); if (Array_rune_arr_eq(end_slice, end_runes)) { marks--; if (marks == 0) { return Array_rune_string(builtin__array_slice(runes, start_index, i)); } i = i + end_runes.len - 1; continue; } } } return _S(""); } Array_string strings__split_capital(string s) { Array_string res = builtin____new_array_with_default(0, 0, sizeof(string), 0); int word_start = 0; for (int idx = 0; idx < s.len; ++idx) { u8 c = s.str[idx]; if (builtin__u8_is_capital(c)) { if (word_start != idx) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr_ni(s, word_start, idx) })); } word_start = idx; continue; } } if (word_start != s.len) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr_ni(s, word_start, 2147483647) })); } return res; } inline VV_LOC bool builtin__closure__is_ppc64(void) { #if 0 { } #else { return false; } #endif return 0; } inline VV_LOC voidptr* builtin__closure__closure_slot_meta(voidptr exec_ptr) { return ((voidptr*)(((u8*)(exec_ptr)) - _const_builtin__closure__assumed_page_size)); } VV_LOC void builtin__closure__closure_register_page(voidptr exec_page_start) { { // Unsafe block builtin__closure__ClosurePage* node = ((builtin__closure__ClosurePage*)(builtin___v_malloc(sizeof(builtin__closure__ClosurePage)))); *node = ((builtin__closure__ClosurePage){.next = g_closure.pages,.exec_page_start = exec_page_start,}); g_closure.pages = node; } } VV_LOC bool builtin__closure__closure_is_managed(voidptr exec_ptr) { if (builtin__isnil(exec_ptr)) { return false; } usize exec_addr = ((usize)(exec_ptr)); builtin__closure__ClosurePage* page = g_closure.pages; for (;;) { if (!(page != ((void*)0))) break; usize page_addr = ((usize)(page->exec_page_start)); if (exec_addr >= page_addr && exec_addr < page_addr + ((usize)(g_closure.v_page_size))) { usize slot_offset = exec_addr - page_addr; return slot_offset >= ((usize)(_const_builtin__closure__closure_size)) && VSAFE_MOD_usize(slot_offset , ((usize)(_const_builtin__closure__closure_size))) == 0; } page = page->next; } return false; } VV_LOC builtin__closure__ClosureLiveInfo builtin__closure__closure_live_delete(voidptr exec_ptr) { builtin__closure__ClosureLiveInfo* _t2 = (builtin__closure__ClosureLiveInfo*)(builtin__map_get_check(ADDR(map, g_closure.live), &(voidptr[]){exec_ptr})); _option_builtin__closure__ClosureLiveInfo _t1 = {0}; if (_t2) { *((builtin__closure__ClosureLiveInfo*)&_t1.data) = *((builtin__closure__ClosureLiveInfo*)_t2); } else { _t1.state = 2; _t1.err = builtin___v_error(_S("map key does not exist")); } if (_t1.state == 0) { builtin__closure__ClosureLiveInfo info = (*(builtin__closure__ClosureLiveInfo*)_t1.data); (*(builtin__closure__ClosureLiveInfo*)builtin__map_get_and_set((map*)&g_closure.live, &(voidptr[]){exec_ptr}, &(builtin__closure__ClosureLiveInfo[]){ (builtin__closure__ClosureLiveInfo){.ctx = 0,.owns_data = 0,.generation = 0,} })) = ((builtin__closure__ClosureLiveInfo){.ctx = 0,.owns_data = 0,.generation = 0,}); builtin__map_delete(&g_closure.live, &(voidptr[]){exec_ptr}); return info; } if (_t1.state == 2 && _t1.err._object != _const_none__._object) { builtin___v_free(_t1.err._object); } return ((builtin__closure__ClosureLiveInfo){.ctx = 0,.owns_data = 0,.generation = 0,}); } VV_LOC builtin__closure__ClosureLifetimeState* builtin__closure__new_closure_lifetime_state_no_lock(void) { builtin__closure__ClosureLifetimeState* state = g_closure.free_lifetime_states; if (!builtin__isnil(state)) { g_closure.free_lifetime_states = state->next_free; } else { { // Unsafe block state = ((builtin__closure__ClosureLifetimeState*)(builtin___v_malloc(sizeof(builtin__closure__ClosureLifetimeState)))); } g_closure.lifetime_state_allocs++; } g_closure.next_lifetime_generation++; { // Unsafe block *state = ((builtin__closure__ClosureLifetimeState){.owner_thread = builtin__closure__closure_current_thread_id_platform(),.active = 0,.disposed = 0,.suspended = 0,.frame_start = 0,.frame_gen = 0,.generation = g_closure.next_lifetime_generation,.frame_generation = 0,.records = builtin____new_array(0, 0, sizeof(builtin__closure__ClosureLifetimeRecord)),.frames = builtin____new_array(0, 0, sizeof(builtin__closure__ClosureLifetimeFrame)),.next_free = ((void*)0),}); } return state; } VV_LOC builtin__closure__ClosureLifetimeState* builtin__closure__new_closure_lifetime_state(void) { builtin__closure__closure_mtx_lock_platform(); builtin__closure__ClosureLifetimeState* state = builtin__closure__new_closure_lifetime_state_no_lock(); builtin__closure__closure_mtx_unlock_platform(); return state; } VV_LOC void builtin__closure__closure_lifetime_recycle_state_no_lock(builtin__closure__ClosureLifetimeState** state) { (*state)->disposed = true; (*state)->active = false; (*state)->suspended = 0; (*state)->frame_start = 0; (*state)->frame_gen = 0; (*state)->frame_generation = 0; { // Unsafe block builtin__array_free(&(*state)->records); builtin__array_free(&(*state)->frames); } (*state)->records = builtin____new_array_with_default(0, 0, sizeof(builtin__closure__ClosureLifetimeRecord), 0); (*state)->frames = builtin____new_array_with_default(0, 0, sizeof(builtin__closure__ClosureLifetimeFrame), 0); (*state)->next_free = g_closure.free_lifetime_states; g_closure.free_lifetime_states = *state; } VV_LOC string builtin__closure__closure_lifetime_error(builtin__closure__ClosureLifetimeState* state, u64 generation, u64 thread_id) { if (state->disposed || state->generation != generation) { return _S("closure lifetime used after dispose"); } if (state->owner_thread != thread_id) { return _S("closure lifetime used from a different thread"); } return _S(""); } VV_LOC _result_builtin__closure__ClosureLifetimeState_ptr builtin__closure__Lifetime_ensure_state(builtin__closure__Lifetime* lifetime) { builtin__closure__closure_ensure_initialized(); if (builtin__isnil(lifetime->state)) { if (lifetime->disposed) { return (_result_builtin__closure__ClosureLifetimeState_ptr){ .is_error=true, .err=builtin___v_error(_S("closure lifetime used after dispose")), .data={E_STRUCT} }; } lifetime->state = builtin__closure__new_closure_lifetime_state(); lifetime->generation = lifetime->state->generation; _result_builtin__closure__ClosureLifetimeState_ptr _t2; builtin___result_ok(&(builtin__closure__ClosureLifetimeState*[]) { lifetime->state }, (_result*)(&_t2), sizeof(builtin__closure__ClosureLifetimeState*)); return _t2; } builtin__closure__closure_mtx_lock_platform(); builtin__closure__ClosureLifetimeState* state = lifetime->state; if (lifetime->disposed || state->disposed || state->generation != lifetime->generation) { builtin__closure__closure_mtx_unlock_platform(); return (_result_builtin__closure__ClosureLifetimeState_ptr){ .is_error=true, .err=builtin___v_error(_S("closure lifetime used after dispose")), .data={E_STRUCT} }; } builtin__closure__closure_mtx_unlock_platform(); _result_builtin__closure__ClosureLifetimeState_ptr _t4; builtin___result_ok(&(builtin__closure__ClosureLifetimeState*[]) { state }, (_result*)(&_t4), sizeof(builtin__closure__ClosureLifetimeState*)); return _t4; } VV_LOC voidptr builtin__closure__closure_slot_data(voidptr exec_ptr) { { // Unsafe block voidptr* p = builtin__closure__closure_slot_meta(exec_ptr); if (builtin__closure__is_ppc64()) { return p[2]; } return p[0]; } return 0; } VV_LOC bool builtin__closure__closure_release_no_lock(voidptr exec_ptr, u64 generation) { if (!builtin__closure__closure_is_managed(exec_ptr)) { return false; } builtin__closure__ClosureLiveInfo* _t3 = (builtin__closure__ClosureLiveInfo*)(builtin__map_get_check(ADDR(map, g_closure.live), &(voidptr[]){exec_ptr})); _option_builtin__closure__ClosureLiveInfo _t2 = {0}; if (_t3) { *((builtin__closure__ClosureLiveInfo*)&_t2.data) = *((builtin__closure__ClosureLiveInfo*)_t3); } else { _t2.state = 2; _t2.err = builtin___v_error(_S("map key does not exist")); } ; if (_t2.state != 0) { return false; } builtin__closure__ClosureLiveInfo info = (*(builtin__closure__ClosureLiveInfo*)_t2.data); if (generation != 0 && info.generation != generation) { return false; } voidptr data = builtin__closure__closure_slot_data(exec_ptr); builtin__closure__closure_live_delete(exec_ptr); if (info.owns_data && !builtin__isnil(data)) { builtin___v_free(data); } { // Unsafe block voidptr* p = builtin__closure__closure_slot_meta(exec_ptr); p[0] = g_closure.free_closure_ptr; if (builtin__closure__is_ppc64()) { p[1] = ((void*)0); p[2] = ((void*)0); p[3] = ((void*)0); } else { p[1] = ((void*)0); } g_closure.free_closure_ptr = exec_ptr; } return true; } VV_LOC void builtin__closure__closure_lifetime_release_records_no_lock(Array_builtin__closure__ClosureLifetimeRecord records, int start, int end) { for (int i = start; i < end; ++i) { builtin__closure__ClosureLifetimeRecord record = (*(builtin__closure__ClosureLifetimeRecord*)builtin__array_get(records, i)); builtin__closure__closure_release_no_lock(record.exec_ptr, record.generation); } } VV_LOC void builtin__closure__closure_lifetime_reclaim_no_lock(builtin__closure__ClosureLifetimeState* state, int retain) { int keep = (retain < 0 ? (0) : (retain)); if (state->frames.len <= keep) { return; } int reclaim_count = state->frames.len - keep; int cutoff = 0; for (int i = 0; i < reclaim_count; ++i) { builtin__closure__ClosureLifetimeFrame frame = (*(builtin__closure__ClosureLifetimeFrame*)builtin__array_get(state->frames, i)); builtin__closure__closure_lifetime_release_records_no_lock(state->records, frame.start, frame.end); cutoff = frame.end; } builtin__array_delete_many(&state->frames, 0, reclaim_count); if (cutoff > 0) { builtin__array_delete_many(&state->records, 0, cutoff); for (int _t1 = 0; _t1 < state->frames.len; ++_t1) { builtin__closure__ClosureLifetimeFrame* frame = ((builtin__closure__ClosureLifetimeFrame*)state->frames.data) + _t1; frame->start -= cutoff; frame->end -= cutoff; } } } VV_LOC void builtin__closure__closure_ensure_initialized(void) { builtin__closure__closure_init_once_platform(); } builtin__closure__Lifetime builtin__closure__new_lifetime(void) { builtin__closure__closure_ensure_initialized(); builtin__closure__ClosureLifetimeState* state = builtin__closure__new_closure_lifetime_state(); return ((builtin__closure__Lifetime){.state = state,.generation = state->generation,.disposed = 0,}); } VV_LOC _result_builtin__closure__FrameToken builtin__closure__Lifetime_begin_frame(builtin__closure__Lifetime* lifetime) { _result_builtin__closure__ClosureLifetimeState_ptr _t1 = builtin__closure__Lifetime_ensure_state(lifetime); if (_t1.is_error) { _result_builtin__closure__FrameToken _t2 = {0}; _t2.is_error = true; _t2.err = _t1.err; return _t2; } builtin__closure__ClosureLifetimeState* state = (*(builtin__closure__ClosureLifetimeState**)_t1.data); u64 thread_id = builtin__closure__closure_current_thread_id_platform(); builtin__closure__closure_mtx_lock_platform(); string err = builtin__closure__closure_lifetime_error(state, lifetime->generation, thread_id); if ((err).len != 0) { builtin__closure__closure_mtx_unlock_platform(); return (_result_builtin__closure__FrameToken){ .is_error=true, .err=builtin___v_error(err), .data={E_STRUCT} }; } if (state->active) { builtin__closure__closure_mtx_unlock_platform(); return (_result_builtin__closure__FrameToken){ .is_error=true, .err=builtin___v_error(_S("closure lifetime frames can not be nested")), .data={E_STRUCT} }; } if (state->suspended > 0) { builtin__closure__closure_mtx_unlock_platform(); return (_result_builtin__closure__FrameToken){ .is_error=true, .err=builtin___v_error(_S("closure lifetime frame while suspended")), .data={E_STRUCT} }; } builtin__closure__ClosureLifetimeState** _t7 = (builtin__closure__ClosureLifetimeState**)(builtin__map_get_check(ADDR(map, g_closure.active_lifetimes), &(u64[]){thread_id})); _option_builtin__closure__ClosureLifetimeState_ptr _t6 = {0}; if (_t7) { *((builtin__closure__ClosureLifetimeState**)&_t6.data) = *((builtin__closure__ClosureLifetimeState**)_t7); } else { _t6.state = 2; _t6.err = builtin___v_error(_S("map key does not exist")); } if (_t6.state == 0) { builtin__closure__ClosureLifetimeState* _dummy_6 = (*(builtin__closure__ClosureLifetimeState**)_t6.data); builtin__closure__closure_mtx_unlock_platform(); return (_result_builtin__closure__FrameToken){ .is_error=true, .err=builtin___v_error(_S("another closure lifetime is already active on this thread")), .data={E_STRUCT} }; } if (_t6.state == 2 && _t6.err._object != _const_none__._object) { builtin___v_free(_t6.err._object); } state->frame_generation++; state->active = true; state->frame_start = state->records.len; state->frame_gen = state->frame_generation; (*(builtin__closure__ClosureLifetimeState**)builtin__map_get_and_set((map*)&g_closure.active_lifetimes, &(u64[]){thread_id}, &(builtin__closure__ClosureLifetimeState*[]){ 0 })) = state; builtin__closure__closure_mtx_unlock_platform(); _result_builtin__closure__FrameToken _t9; builtin___result_ok(&(builtin__closure__FrameToken[]) { ((builtin__closure__FrameToken){.state = state,.thread_id = thread_id,.state_generation = lifetime->generation,.generation = state->frame_generation,}) }, (_result*)(&_t9), sizeof(builtin__closure__FrameToken)); return _t9; } VV_LOC _result_void builtin__closure__Lifetime_end_frame(builtin__closure__Lifetime* lifetime, builtin__closure__FrameToken token) { if (builtin__isnil(token.state)) { return (_result_void){ .is_error=true, .err=builtin___v_error(_S("invalid closure lifetime frame token")), .data={E_STRUCT} }; } builtin__closure__ClosureLifetimeState* state = token.state; u64 thread_id = builtin__closure__closure_current_thread_id_platform(); builtin__closure__closure_mtx_lock_platform(); string err = builtin__closure__closure_lifetime_error(state, token.state_generation, thread_id); if ((err).len != 0) { builtin__closure__closure_mtx_unlock_platform(); return (_result_void){ .is_error=true, .err=builtin___v_error(err), .data={E_STRUCT} }; } if (token.thread_id != thread_id || token.generation != state->frame_gen || !state->active) { builtin__closure__closure_mtx_unlock_platform(); return (_result_void){ .is_error=true, .err=builtin___v_error(_S("invalid closure lifetime frame token")), .data={E_STRUCT} }; } builtin__array_push((array*)&state->frames, _MOV((builtin__closure__ClosureLifetimeFrame[]){ ((builtin__closure__ClosureLifetimeFrame){.start = state->frame_start,.end = state->records.len,}) })); state->active = false; state->frame_start = 0; state->frame_gen = 0; (*(builtin__closure__ClosureLifetimeState**)builtin__map_get_and_set((map*)&g_closure.active_lifetimes, &(u64[]){thread_id}, &(builtin__closure__ClosureLifetimeState*[]){ 0 })) = ((void*)0); builtin__map_delete(&g_closure.active_lifetimes, &(u64[]){thread_id}); builtin__closure__closure_mtx_unlock_platform(); return (_result_void){0}; } _result_void builtin__closure__Lifetime_frame(builtin__closure__Lifetime* lifetime, void (*work)(void)) { _result_builtin__closure__FrameToken _t1 = builtin__closure__Lifetime_begin_frame(lifetime); if (_t1.is_error) { _result_void _t2 = {0}; _t2.is_error = true; _t2.err = _t1.err; return _t2; } builtin__closure__FrameToken token = (*(builtin__closure__FrameToken*)_t1.data); bool ended = false; work(); _result_void _t3 = builtin__closure__Lifetime_end_frame(lifetime, token); if (_t3.is_error) { { // defer begin if (!ended) { _result_void _t4 = builtin__closure__Lifetime_end_frame(lifetime, token); (void)_t4; ; } } // defer end _result_void _t5 = {0}; _t5.is_error = true; _t5.err = _t3.err; return _t5; } ; ended = true; { // defer begin if (!ended) { _result_void _t6 = builtin__closure__Lifetime_end_frame(lifetime, token); (void)_t6; ; } } // defer end return (_result_void){0}; } _result_void builtin__closure__Lifetime_reclaim(builtin__closure__Lifetime* lifetime, int retain) { _result_builtin__closure__ClosureLifetimeState_ptr _t1 = builtin__closure__Lifetime_ensure_state(lifetime); if (_t1.is_error) { _result_void _t2 = {0}; _t2.is_error = true; _t2.err = _t1.err; return _t2; } builtin__closure__ClosureLifetimeState* state = (*(builtin__closure__ClosureLifetimeState**)_t1.data); u64 thread_id = builtin__closure__closure_current_thread_id_platform(); builtin__closure__closure_mtx_lock_platform(); string err = builtin__closure__closure_lifetime_error(state, lifetime->generation, thread_id); if ((err).len != 0) { builtin__closure__closure_mtx_unlock_platform(); return (_result_void){ .is_error=true, .err=builtin___v_error(err), .data={E_STRUCT} }; } if (state->active) { builtin__closure__closure_mtx_unlock_platform(); return (_result_void){ .is_error=true, .err=builtin___v_error(_S("closure lifetime reclaim while a frame is active")), .data={E_STRUCT} }; } builtin__closure__closure_lifetime_reclaim_no_lock(state, retain); builtin__closure__closure_mtx_unlock_platform(); return (_result_void){0}; } _result_void builtin__closure__Lifetime_reclaim_all(builtin__closure__Lifetime* lifetime) { _result_void _t1 = builtin__closure__Lifetime_reclaim(lifetime, 0); if (_t1.is_error) { _result_void _t2 = {0}; _t2.is_error = true; _t2.err = _t1.err; return _t2; } ; return (_result_void){0}; } _result_void builtin__closure__Lifetime_dispose(builtin__closure__Lifetime* lifetime) { _result_builtin__closure__ClosureLifetimeState_ptr _t1 = builtin__closure__Lifetime_ensure_state(lifetime); if (_t1.is_error) { _result_void _t2 = {0}; _t2.is_error = true; _t2.err = _t1.err; return _t2; } builtin__closure__ClosureLifetimeState* state = (*(builtin__closure__ClosureLifetimeState**)_t1.data); u64 thread_id = builtin__closure__closure_current_thread_id_platform(); builtin__closure__closure_mtx_lock_platform(); string err = builtin__closure__closure_lifetime_error(state, lifetime->generation, thread_id); if ((err).len != 0) { builtin__closure__closure_mtx_unlock_platform(); return (_result_void){ .is_error=true, .err=builtin___v_error(err), .data={E_STRUCT} }; } if (state->active) { builtin__closure__closure_mtx_unlock_platform(); return (_result_void){ .is_error=true, .err=builtin___v_error(_S("closure lifetime dispose while a frame is active")), .data={E_STRUCT} }; } if (state->suspended > 0) { builtin__closure__closure_mtx_unlock_platform(); return (_result_void){ .is_error=true, .err=builtin___v_error(_S("closure lifetime dispose while suspended")), .data={E_STRUCT} }; } builtin__closure__closure_lifetime_reclaim_no_lock(state, 0); lifetime->state = ((void*)0); lifetime->disposed = true; builtin__closure__closure_lifetime_recycle_state_no_lock(&state); builtin__closure__closure_mtx_unlock_platform(); return (_result_void){0}; } _result_void builtin__closure__Lifetime_suspend(builtin__closure__Lifetime* lifetime, void (*work)(void)) { _result_builtin__closure__ClosureLifetimeState_ptr _t1 = builtin__closure__Lifetime_ensure_state(lifetime); if (_t1.is_error) { _result_void _t2 = {0}; _t2.is_error = true; _t2.err = _t1.err; return _t2; } builtin__closure__ClosureLifetimeState* state = (*(builtin__closure__ClosureLifetimeState**)_t1.data); u64 thread_id = builtin__closure__closure_current_thread_id_platform(); builtin__closure__closure_mtx_lock_platform(); string err = builtin__closure__closure_lifetime_error(state, lifetime->generation, thread_id); if ((err).len != 0) { builtin__closure__closure_mtx_unlock_platform(); return (_result_void){ .is_error=true, .err=builtin___v_error(err), .data={E_STRUCT} }; } builtin__closure__ClosureLifetimeState** _t5 = (builtin__closure__ClosureLifetimeState**)(builtin__map_get_check(ADDR(map, g_closure.active_lifetimes), &(u64[]){thread_id})); _option_builtin__closure__ClosureLifetimeState_ptr _t4 = {0}; if (_t5) { *((builtin__closure__ClosureLifetimeState**)&_t4.data) = *((builtin__closure__ClosureLifetimeState**)_t5); } else { _t4.state = 2; _t4.err = builtin___v_error(_S("map key does not exist")); } if (_t4.state == 0) { builtin__closure__ClosureLifetimeState* active = (*(builtin__closure__ClosureLifetimeState**)_t4.data); if (!(active == state || (active != 0 && state != 0 && builtin__closure__ClosureLifetimeState_struct_eq(*active, *state)))) { builtin__closure__closure_mtx_unlock_platform(); return (_result_void){ .is_error=true, .err=builtin___v_error(_S("another closure lifetime is already active on this thread")), .data={E_STRUCT} }; } } if (_t4.state == 2 && _t4.err._object != _const_none__._object) { builtin___v_free(_t4.err._object); } state->suspended++; builtin__closure__closure_mtx_unlock_platform(); work(); { // defer begin builtin__closure__closure_mtx_lock_platform(); state->suspended--; builtin__closure__closure_mtx_unlock_platform(); } // defer end return (_result_void){0}; } _result_void builtin__closure__Lifetime_untracked(builtin__closure__Lifetime* lifetime, void (*work)(void)) { _result_void _t1 = builtin__closure__Lifetime_suspend(lifetime, work); if (_t1.is_error) { _result_void _t2 = {0}; _t2.is_error = true; _t2.err = _t1.err; return _t2; } ; return (_result_void){0}; } VV_LOC void builtin__closure__closure_alloc(void) { u8* p = builtin__closure__closure_alloc_platform(); if (builtin__isnil(p)) { return; } u8* x = p + g_closure.v_page_size; int remaining = VSAFE_DIV_int(g_closure.v_page_size , _const_builtin__closure__closure_size); builtin__closure__closure_register_page(x); g_closure.closure_ptr = x; g_closure.closure_cap = remaining; for (;;) { if (!(remaining > 0)) break; builtin__vmemcpy(x, &_const_builtin__closure__closure_thunk[0], 15); remaining--; { // Unsafe block x += _const_builtin__closure__closure_size; } } builtin__closure__closure_memory_protect_platform(g_closure.closure_ptr, g_closure.v_page_size, builtin__closure__MemoryProtectAtrr__read_exec); } VV_LOC void builtin__closure__closure_init_body(void) { int page_size = builtin__closure__get_page_size_platform(); g_closure.v_page_size = page_size; g_closure.live = builtin__new_map(sizeof(voidptr), sizeof(builtin__closure__ClosureLiveInfo), &builtin__map_hash_int_8, &builtin__map_eq_int_8, &builtin__map_clone_int_8, &builtin__map_free_nop) ; g_closure.active_lifetimes = builtin__new_map(sizeof(u64), sizeof(builtin__closure__ClosureLifetimeState*), &builtin__map_hash_int_8, &builtin__map_eq_int_8, &builtin__map_clone_int_8, &builtin__map_free_nop) ; g_closure.next_generation = 0; g_closure.free_lifetime_states = ((void*)0); g_closure.next_lifetime_generation = 0; g_closure.lifetime_state_allocs = 0; builtin__closure__closure_mtx_lock_init_platform(); builtin__closure__closure_alloc(); { // Unsafe block builtin__closure__closure_memory_protect_platform(g_closure.closure_ptr, page_size, builtin__closure__MemoryProtectAtrr__read_write); builtin__vmemcpy(g_closure.closure_ptr, &_const_builtin__closure__closure_get_data_bytes[0], 6); builtin__closure__closure_memory_protect_platform(g_closure.closure_ptr, page_size, builtin__closure__MemoryProtectAtrr__read_exec); } if (builtin__closure__is_ppc64()) { voidptr* desc = ((voidptr*)(((u8*)(g_closure.closure_ptr)) - _const_builtin__closure__assumed_page_size)); { // Unsafe block desc[0] = g_closure.closure_ptr; desc[1] = ((void*)0); } g_closure.closure_get_data = ((builtin__closure__ClosureGetDataFn)(desc)); } else { g_closure.closure_get_data = g_closure.closure_ptr; } { // Unsafe block g_closure.closure_ptr = ((u8*)(g_closure.closure_ptr)) + _const_builtin__closure__closure_size; } g_closure.closure_cap--; } #if 1 #endif inline VV_LOC voidptr builtin__closure__closure_mtx_ptr_platform(void) { return ((voidptr)(&g_closure.ClosureMutex.closure_mtx[0])); } inline VV_LOC u8* builtin__closure__closure_alloc_platform(void) { u8* p = ((u8*)(((void*)0))); #if 0 { } #else { p = mmap(0, g_closure.v_page_size * 2, (PROT_READ | PROT_WRITE), (MAP_ANONYMOUS | MAP_PRIVATE), -1, 0); if (p == ((u8*)(MAP_FAILED))) { return ((void*)0); } } #endif return p; } inline VV_LOC void builtin__closure__closure_memory_protect_platform(voidptr ptr, isize size, builtin__closure__MemoryProtectAtrr attr) { #if 0 { } #else { if (attr == (builtin__closure__MemoryProtectAtrr__read_exec)) { mprotect(ptr, size, (PROT_READ | PROT_EXEC)); } else if (attr == (builtin__closure__MemoryProtectAtrr__read_write)) { mprotect(ptr, size, (PROT_READ | PROT_WRITE)); } } #endif } inline VV_LOC int builtin__closure__get_page_size_platform(void) { int page_size = 0x4000; #if 1 { page_size = ((int)(sysconf(_SC_PAGESIZE))); } #endif page_size = page_size * ((VSAFE_DIV_int((_const_builtin__closure__assumed_page_size - 1) , page_size)) + 1); return page_size; } inline VV_LOC void builtin__closure__closure_mtx_lock_init_platform(void) { #if 1 { pthread_mutex_init(builtin__closure__closure_mtx_ptr_platform(), 0); } #endif } inline VV_LOC void builtin__closure__closure_mtx_lock_platform(void) { #if 1 { pthread_mutex_lock(builtin__closure__closure_mtx_ptr_platform()); } #endif } inline VV_LOC void builtin__closure__closure_mtx_unlock_platform(void) { #if 1 { pthread_mutex_unlock(builtin__closure__closure_mtx_ptr_platform()); } #endif } inline VV_LOC u64 builtin__closure__closure_current_thread_id_platform(void) { #if 1 { return ((u64)(pthread_self())); } #endif return ((u64)(0)); } inline VV_LOC void builtin__closure__closure_init_once_platform(void) { #if 0 { } #else { v_closure_init_once(builtin__closure__closure_init_body); } #endif } inline multi_return_u64_u64 math__bits__mul_64(u64 x, u64 y) { u64 hi = ((u64)(0)); u64 lo = ((u64)(0)); #if defined(_MSC_VER) { } #elif defined(__V_amd64) { __asm__ ( "mulq %%rdx\n\t" : [lo] "=a" (lo), [hi] "=d" (hi) : [x] "a" (x), [y] "d" (y) : "cc" ); return (multi_return_u64_u64){.arg0=hi, .arg1=lo}; } #endif return math__bits__mul_64_default(x, y); } inline multi_return_u64_u64 math__bits__mul_add_64(u64 x, u64 y, u64 z) { u64 hi = ((u64)(0)); u64 lo = ((u64)(0)); #if defined(_MSC_VER) { } #elif defined(__V_amd64) { __asm__ ( "mulq %%rdx\n\t" "addq %[z], %%rax\n\t" "adcq $0, %%rdx\n\t" : [lo] "=a" (lo), [hi] "=d" (hi) : [x] "a" (x), [y] "d" (y), [z] "r" (z) : "cc" ); return (multi_return_u64_u64){.arg0=hi, .arg1=lo}; } #endif return math__bits__mul_add_64_default(x, y, z); } inline multi_return_u64_u64 math__bits__div_64(u64 hi, u64 lo, u64 y1) { u64 y = y1; if (y == 0) { builtin___v_panic(_const_math__bits__divide_error); VUNREACHABLE(); } if (y <= hi) { builtin___v_panic(_const_math__bits__overflow_error); VUNREACHABLE(); } u64 quo = ((u64)(0)); u64 rem = ((u64)(0)); #if defined(_MSC_VER) { } #elif defined(__V_amd64) { __asm__ ( "div %[y]\n\t" : [quo] "=a" (quo), [rem] "=d" (rem) : [hi] "d" (hi), [lo] "a" (lo), [y] "r" (y) : "cc" ); return (multi_return_u64_u64){.arg0=quo, .arg1=rem}; } #endif return math__bits__div_64_default(hi, lo, y1); } inline int math__bits__leading_zeros_8(u8 x) { if (x == 0) { return 8; } #if defined(_MSC_VER) { } #elif !defined(__TINYC__) { } #endif return math__bits__leading_zeros_8_default(x); } inline int math__bits__leading_zeros_16(u16 x) { if (x == 0) { return 16; } #if defined(_MSC_VER) { } #elif !defined(__TINYC__) { } #endif return math__bits__leading_zeros_16_default(x); } inline int math__bits__leading_zeros_32(u32 x) { if (x == 0) { return 32; } #if defined(_MSC_VER) { } #elif !defined(__TINYC__) { } #endif return math__bits__leading_zeros_32_default(x); } inline int math__bits__leading_zeros_64(u64 x) { if (x == 0) { return 64; } #if defined(_MSC_VER) { } #elif !defined(__TINYC__) { } #endif return math__bits__leading_zeros_64_default(x); } inline int math__bits__trailing_zeros_8(u8 x) { if (x == 0) { return 8; } #if defined(_MSC_VER) { } #elif !defined(__TINYC__) { } #endif return math__bits__trailing_zeros_8_default(x); } inline int math__bits__trailing_zeros_16(u16 x) { if (x == 0) { return 16; } #if defined(_MSC_VER) { } #elif !defined(__TINYC__) { } #endif return math__bits__trailing_zeros_16_default(x); } inline int math__bits__trailing_zeros_32(u32 x) { if (x == 0) { return 32; } #if defined(_MSC_VER) { } #elif !defined(__TINYC__) { } #endif return math__bits__trailing_zeros_32_default(x); } inline int math__bits__trailing_zeros_64(u64 x) { if (x == 0) { return 64; } #if defined(_MSC_VER) { } #elif !defined(__TINYC__) { } #endif return math__bits__trailing_zeros_64_default(x); } inline int math__bits__ones_count_8(u8 x) { #if defined(_MSC_VER) { } #elif !defined(__TINYC__) { } #endif return math__bits__ones_count_8_default(x); } inline int math__bits__ones_count_16(u16 x) { #if defined(_MSC_VER) { } #elif !defined(__TINYC__) { } #endif return math__bits__ones_count_16_default(x); } inline int math__bits__ones_count_32(u32 x) { #if defined(_MSC_VER) { } #elif !defined(__TINYC__) { } #endif return math__bits__ones_count_32_default(x); } inline int math__bits__ones_count_64(u64 x) { #if defined(_MSC_VER) { } #elif !defined(__TINYC__) { } #endif return math__bits__ones_count_64_default(x); } inline int math__bits__pure_v_but_overridden_by_c_leading_zeros_8(u8 x) { return math__bits__leading_zeros_8_default(x); } inline VV_LOC int math__bits__leading_zeros_8_default(u8 x) { return 8 - math__bits__len_8(x); } inline int math__bits__pure_v_but_overridden_by_c_leading_zeros_16(u16 x) { return math__bits__leading_zeros_16_default(x); } inline VV_LOC int math__bits__leading_zeros_16_default(u16 x) { return 16 - math__bits__len_16(x); } inline int math__bits__pure_v_but_overridden_by_c_leading_zeros_32(u32 x) { return math__bits__leading_zeros_32_default(x); } inline VV_LOC int math__bits__leading_zeros_32_default(u32 x) { return 32 - math__bits__len_32(x); } inline int math__bits__pure_v_but_overridden_by_c_leading_zeros_64(u64 x) { return math__bits__leading_zeros_64_default(x); } inline VV_LOC int math__bits__leading_zeros_64_default(u64 x) { return 64 - math__bits__len_64(x); } inline int math__bits__pure_v_but_overridden_by_c_trailing_zeros_8(u8 x) { return math__bits__trailing_zeros_8_default(x); } inline VV_LOC int math__bits__trailing_zeros_8_default(u8 x) { return ((int)(_const_math__bits__ntz_8_tab[x])); } inline int math__bits__pure_v_but_overridden_by_c_trailing_zeros_16(u16 x) { return math__bits__trailing_zeros_16_default(x); } inline VV_LOC int math__bits__trailing_zeros_16_default(u16 x) { if (x == 0) { return 16; } return ((int)(_const_math__bits__de_bruijn32tab[v__rshift_u32(((u32)((x & -x))) * _const_math__bits__de_bruijn32, (u64)27)])); } inline int math__bits__pure_v_but_overridden_by_c_trailing_zeros_32(u32 x) { return math__bits__trailing_zeros_32_default(x); } inline VV_LOC int math__bits__trailing_zeros_32_default(u32 x) { if (x == 0) { return 32; } return ((int)(_const_math__bits__de_bruijn32tab[v__rshift_u32(((x & -x)) * _const_math__bits__de_bruijn32, (u64)27)])); } inline int math__bits__pure_v_but_overridden_by_c_trailing_zeros_64(u64 x) { return math__bits__trailing_zeros_64_default(x); } inline VV_LOC int math__bits__trailing_zeros_64_default(u64 x) { if (x == 0) { return 64; } return ((int)(_const_math__bits__de_bruijn64tab[((int)(v__rshift_u64(((x & -x)) * _const_math__bits__de_bruijn64, (u64)58)))])); } inline int math__bits__pure_v_but_overridden_by_c_ones_count_8(u8 x) { return math__bits__ones_count_8_default(x); } inline VV_LOC int math__bits__ones_count_8_default(u8 x) { return ((int)(_const_math__bits__pop_8_tab[x])); } inline int math__bits__pure_v_but_overridden_by_c_ones_count_16(u16 x) { return math__bits__ones_count_16_default(x); } inline VV_LOC int math__bits__ones_count_16_default(u16 x) { return ((int)((u8)(_const_math__bits__pop_8_tab[v__rshift_u16(x, (u64)8)] + _const_math__bits__pop_8_tab[(x & ((u16)(0xff)))]))); } inline int math__bits__pure_v_but_overridden_by_c_ones_count_32(u32 x) { return math__bits__ones_count_32_default(x); } inline VV_LOC int math__bits__ones_count_32_default(u32 x) { return ((int)((u8)((u8)((u8)(_const_math__bits__pop_8_tab[v__rshift_u32(x, (u64)24)] + _const_math__bits__pop_8_tab[((v__rshift_u32(x, (u64)16)) & 0xff)]) + _const_math__bits__pop_8_tab[((v__rshift_u32(x, (u64)8)) & 0xff)]) + _const_math__bits__pop_8_tab[(x & ((u32)(0xff)))]))); } inline int math__bits__pure_v_but_overridden_by_c_ones_count_64(u64 x) { return math__bits__ones_count_64_default(x); } inline VV_LOC int math__bits__ones_count_64_default(u64 x) { u64 y = (((v__rshift_u64(x, (u64)((u64)(1)))) & ((_const_math__bits__m0 & _const_max_u64)))) + ((x & ((_const_math__bits__m0 & _const_max_u64)))); y = (((v__rshift_u64(y, (u64)((u64)(2)))) & ((_const_math__bits__m1 & _const_max_u64)))) + ((y & ((_const_math__bits__m1 & _const_max_u64)))); y = (((v__rshift_u64(y, (u64)4)) + y) & ((_const_math__bits__m2 & _const_max_u64))); y += v__rshift_u64(y, (u64)8); y += v__rshift_u64(y, (u64)16); y += v__rshift_u64(y, (u64)32); return (((int)(y)) & 127); } inline u8 math__bits__rotate_left_8(u8 x, int k) { u8 s = (((u8)(k)) & ((u8)(_const_math__bits__n8 - ((u8)(1))))); return ((v__lshift_u8(x, (u64)s)) | (v__rshift_u8(x, (u64)((u8)(_const_math__bits__n8 - s))))); } inline u16 math__bits__rotate_left_16(u16 x, int k) { u16 s = (((u16)(k)) & ((u16)(_const_math__bits__n16 - ((u16)(1))))); return ((v__lshift_u16(x, (u64)s)) | (v__rshift_u16(x, (u64)((u16)(_const_math__bits__n16 - s))))); } inline u32 math__bits__rotate_left_32(u32 x, int k) { u32 s = (((u32)(k)) & (_const_math__bits__n32 - ((u32)(1)))); return ((v__lshift_u32(x, (u64)s)) | (v__rshift_u32(x, (u64)(_const_math__bits__n32 - s)))); } inline u64 math__bits__rotate_left_64(u64 x, int k) { u64 s = (((u64)(k)) & (_const_math__bits__n64 - ((u64)(1)))); return ((v__lshift_u64(x, (u64)s)) | (v__rshift_u64(x, (u64)(_const_math__bits__n64 - s)))); } inline u8 math__bits__reverse_8(u8 x) { return _const_math__bits__rev_8_tab[x]; } inline u16 math__bits__reverse_16(u16 x) { return (((u16)(_const_math__bits__rev_8_tab[v__rshift_u16(x, (u64)8)])) | (v__lshift_u16(((u16)(_const_math__bits__rev_8_tab[(x & ((u16)(0xff)))])), (u64)8))); } inline u32 math__bits__reverse_32(u32 x) { u64 y = (((((v__rshift_u32(x, (u64)((u32)(1)))) & ((_const_math__bits__m0 & _const_max_u32)))) | (v__lshift_u64(((x & ((_const_math__bits__m0 & _const_max_u32)))), (u64)1)))); y = (((((v__rshift_u64(y, (u64)((u32)(2)))) & ((_const_math__bits__m1 & _const_max_u32)))) | (v__lshift_u64(((y & ((_const_math__bits__m1 & _const_max_u32)))), (u64)((u32)(2)))))); y = (((((v__rshift_u64(y, (u64)((u32)(4)))) & ((_const_math__bits__m2 & _const_max_u32)))) | (v__lshift_u64(((y & ((_const_math__bits__m2 & _const_max_u32)))), (u64)((u32)(4)))))); return math__bits__reverse_bytes_32(((u32)(y))); } inline u64 math__bits__reverse_64(u64 x) { u64 y = (((((v__rshift_u64(x, (u64)((u64)(1)))) & ((_const_math__bits__m0 & _const_max_u64)))) | (v__lshift_u64(((x & ((_const_math__bits__m0 & _const_max_u64)))), (u64)1)))); y = (((((v__rshift_u64(y, (u64)((u64)(2)))) & ((_const_math__bits__m1 & _const_max_u64)))) | (v__lshift_u64(((y & ((_const_math__bits__m1 & _const_max_u64)))), (u64)2)))); y = (((((v__rshift_u64(y, (u64)((u64)(4)))) & ((_const_math__bits__m2 & _const_max_u64)))) | (v__lshift_u64(((y & ((_const_math__bits__m2 & _const_max_u64)))), (u64)4)))); return math__bits__reverse_bytes_64(y); } inline u16 math__bits__reverse_bytes_16(u16 x) { return ((v__rshift_u16(x, (u64)8)) | (v__lshift_u16(x, (u64)8))); } inline u32 math__bits__reverse_bytes_32(u32 x) { u64 y = (((((v__rshift_u32(x, (u64)((u32)(8)))) & ((_const_math__bits__m3 & _const_max_u32)))) | (v__lshift_u64(((x & ((_const_math__bits__m3 & _const_max_u32)))), (u64)((u32)(8)))))); return ((u32)(((v__rshift_u64(y, (u64)16)) | (v__lshift_u64(y, (u64)16))))); } inline u64 math__bits__reverse_bytes_64(u64 x) { u64 y = (((((v__rshift_u64(x, (u64)((u64)(8)))) & ((_const_math__bits__m3 & _const_max_u64)))) | (v__lshift_u64(((x & ((_const_math__bits__m3 & _const_max_u64)))), (u64)((u64)(8)))))); y = (((((v__rshift_u64(y, (u64)((u64)(16)))) & ((_const_math__bits__m4 & _const_max_u64)))) | (v__lshift_u64(((y & ((_const_math__bits__m4 & _const_max_u64)))), (u64)((u64)(16)))))); return ((v__rshift_u64(y, (u64)32)) | (v__lshift_u64(y, (u64)32))); } int math__bits__len_8(u8 x) { return ((int)(_const_math__bits__len_8_tab[x])); } int math__bits__len_16(u16 x) { u16 y = x; int n = 0; if (y >= 256) { y = v__rshift_u16(y, (u64)8); n = 8; } return n + ((int)(_const_math__bits__len_8_tab[((int)(y))])); } int math__bits__len_32(u32 x) { u32 y = x; int n = 0; if (y >= 65536) { y = v__rshift_u32(y, (u64)16); n = 16; } if (y >= 256) { y = v__rshift_u32(y, (u64)8); n += 8; } return n + ((int)(_const_math__bits__len_8_tab[((int)(y))])); } int math__bits__len_64(u64 x) { u64 y = x; int n = 0; if (y >= v__lshift_u64(((u64)(1)), (u64)((u64)(32)))) { y = v__rshift_u64(y, (u64)32); n = 32; } if (y >= v__lshift_u64(((u64)(1)), (u64)((u64)(16)))) { y = v__rshift_u64(y, (u64)16); n += 16; } if (y >= v__lshift_u64(((u64)(1)), (u64)((u64)(8)))) { y = v__rshift_u64(y, (u64)8); n += 8; } return n + ((int)(_const_math__bits__len_8_tab[((int)(y))])); } multi_return_u32_u32 math__bits__add_32(u32 x, u32 y, u32 carry) { u64 sum64 = ((u64)(x)) + ((u64)(y)) + ((u64)(carry)); u32 sum = ((u32)(sum64)); u32 carry_out = ((u32)(v__rshift_u64(sum64, (u64)32))); return (multi_return_u32_u32){.arg0=sum, .arg1=carry_out}; } multi_return_u64_u64 math__bits__add_64(u64 x, u64 y, u64 carry) { u64 sum = x + y + carry; u64 carry_out = v__rshift_u64(((((x & y)) | ((((x | y)) & ~sum)))), (u64)63); return (multi_return_u64_u64){.arg0=sum, .arg1=carry_out}; } multi_return_u32_u32 math__bits__sub_32(u32 x, u32 y, u32 borrow) { u32 diff = x - y - borrow; u32 borrow_out = v__rshift_u32(((((~x & y)) | ((~((x ^ y)) & diff)))), (u64)31); return (multi_return_u32_u32){.arg0=diff, .arg1=borrow_out}; } multi_return_u64_u64 math__bits__sub_64(u64 x, u64 y, u64 borrow) { u64 diff = x - y - borrow; u64 borrow_out = v__rshift_u64(((((~x & y)) | ((~((x ^ y)) & diff)))), (u64)63); return (multi_return_u64_u64){.arg0=diff, .arg1=borrow_out}; } inline multi_return_u32_u32 math__bits__mul_32(u32 x, u32 y) { return math__bits__mul_32_default(x, y); } inline VV_LOC multi_return_u32_u32 math__bits__mul_32_default(u32 x, u32 y) { u64 tmp = ((u64)(x)) * ((u64)(y)); u32 hi = ((u32)(v__rshift_u64(tmp, (u64)32))); u32 lo = ((u32)(tmp)); return (multi_return_u32_u32){.arg0=hi, .arg1=lo}; } inline multi_return_u64_u64 math__bits__pure_v_but_overridden_by_amd64_mul_64(u64 x, u64 y) { return math__bits__mul_64_default(x, y); } VV_LOC multi_return_u64_u64 math__bits__mul_64_default(u64 x, u64 y) { u64 x0 = (x & _const_math__bits__mask32); u64 x1 = v__rshift_u64(x, (u64)32); u64 y0 = (y & _const_math__bits__mask32); u64 y1 = v__rshift_u64(y, (u64)32); u64 w0 = x0 * y0; u64 t = x1 * y0 + (v__rshift_u64(w0, (u64)32)); u64 w1 = (t & _const_math__bits__mask32); u64 w2 = v__rshift_u64(t, (u64)32); w1 += x0 * y1; u64 hi = x1 * y1 + w2 + (v__rshift_u64(w1, (u64)32)); u64 lo = x * y; return (multi_return_u64_u64){.arg0=hi, .arg1=lo}; } inline multi_return_u32_u32 math__bits__mul_add_32(u32 x, u32 y, u32 z) { return math__bits__mul_add_32_default(x, y, z); } inline VV_LOC multi_return_u32_u32 math__bits__mul_add_32_default(u32 x, u32 y, u32 z) { u64 tmp = ((u64)(x)) * ((u64)(y)) + ((u64)(z)); u32 hi = ((u32)(v__rshift_u64(tmp, (u64)32))); u32 lo = ((u32)(tmp)); return (multi_return_u32_u32){.arg0=hi, .arg1=lo}; } inline multi_return_u64_u64 math__bits__pure_v_but_overridden_by_amd64_mul_add_64(u64 x, u64 y, u64 z) { return math__bits__mul_add_64_default(x, y, z); } inline VV_LOC multi_return_u64_u64 math__bits__mul_add_64_default(u64 x, u64 y, u64 z) { multi_return_u64_u64 mr_14968 = math__bits__mul_64(x, y); u64 h = mr_14968.arg0; u64 l = mr_14968.arg1; u64 lo = l + z; u64 hi = h + (u64[]){(lo < l)?1:0}[0]; return (multi_return_u64_u64){.arg0=hi, .arg1=lo}; } inline multi_return_u32_u32 math__bits__div_32(u32 hi, u32 lo, u32 y) { return math__bits__div_32_default(hi, lo, y); } VV_LOC multi_return_u32_u32 math__bits__div_32_default(u32 hi, u32 lo, u32 y) { if (y == 0) { builtin___v_panic(_const_math__bits__divide_error); VUNREACHABLE(); } if (y <= hi) { builtin___v_panic(_const_math__bits__overflow_error); VUNREACHABLE(); } u64 z = ((v__lshift_u64(((u64)(hi)), (u64)32)) | ((u64)(lo))); u32 quo = ((u32)(VSAFE_DIV_u64(z , ((u64)(y))))); u32 rem = ((u32)(VSAFE_MOD_u64(z , ((u64)(y))))); return (multi_return_u32_u32){.arg0=quo, .arg1=rem}; } inline multi_return_u64_u64 math__bits__pure_v_but_overridden_by_amd64_div_64(u64 hi, u64 lo, u64 y1) { return math__bits__div_64_default(hi, lo, y1); } VV_LOC multi_return_u64_u64 math__bits__div_64_default(u64 hi, u64 lo, u64 y1) { u64 y = y1; if (y == 0) { builtin___v_panic(_const_math__bits__divide_error); VUNREACHABLE(); } if (y <= hi) { builtin___v_panic(_const_math__bits__overflow_error); VUNREACHABLE(); } u32 s = ((u32)(math__bits__leading_zeros_64(y))); y = v__lshift_u64(y, (u64)s); u64 yn1 = v__rshift_u64(y, (u64)32); u64 yn0 = (y & _const_math__bits__mask32); u64 ss1 = (v__lshift_u64(hi, (u64)s)); u32 xxx = 64 - s; u64 ss2 = v__rshift_u64(lo, (u64)xxx); if (xxx == 64) { ss2 = 0; } u64 un32 = (ss1 | ss2); u64 un10 = v__lshift_u64(lo, (u64)s); u64 un1 = v__rshift_u64(un10, (u64)32); u64 un0 = (un10 & _const_math__bits__mask32); u64 q1 = VSAFE_DIV_u64(un32 , yn1); u64 rhat = un32 - (q1 * yn1); for (;;) { if (!(q1 >= _const_math__bits__two32 || (q1 * yn0) > ((_const_math__bits__two32 * rhat) + un1))) break; q1--; rhat += yn1; if (rhat >= _const_math__bits__two32) { break; } } u64 un21 = (un32 * _const_math__bits__two32) + (un1 - (q1 * y)); u64 q0 = VSAFE_DIV_u64(un21 , yn1); rhat = un21 - q0 * yn1; for (;;) { if (!(q0 >= _const_math__bits__two32 || (q0 * yn0) > ((_const_math__bits__two32 * rhat) + un0))) break; q0--; rhat += yn1; if (rhat >= _const_math__bits__two32) { break; } } u64 qq = ((q1 * _const_math__bits__two32) + q0); u64 rr = v__rshift_u64(((un21 * _const_math__bits__two32) + un0 - (q0 * y)), (u64)s); return (multi_return_u64_u64){.arg0=qq, .arg1=rr}; } inline u32 math__bits__rem_32(u32 hi, u32 lo, u32 y) { if (y == 0) { builtin___v_panic(_const_math__bits__divide_error); VUNREACHABLE(); } return ((u32)(VSAFE_MOD_u64((((v__lshift_u64(((u64)(hi)), (u64)32)) | ((u64)(lo)))) , ((u64)(y))))); } inline u64 math__bits__rem_64(u64 hi, u64 lo, u64 y) { if (y == 0) { builtin___v_panic(_const_math__bits__divide_error); VUNREACHABLE(); } multi_return_u64_u64 mr_18593 = math__bits__div_64(VSAFE_MOD_u64(hi , y), lo, y); u64 rem = mr_18593.arg1; return rem; } multi_return_f64_int math__bits__normalize(f64 x) { f64 smallest_normal = 2.2250738585072014e-308; if (((x > ((f64)(0.0)) ? (x) : (-x))) < smallest_normal) { return (multi_return_f64_int){.arg0=(f64)(x * (v__lshift_u64(((u64)(1)), (u64)((u64)(52))))), .arg1=-52}; } return (multi_return_f64_int){.arg0=x, .arg1=0}; } inline u32 math__bits__f32_bits(f32 f) { u32 p = *((u32*)(&f)); return p; } inline f32 math__bits__f32_from_bits(u32 b) { f32 p = *((f32*)(&b)); return p; } inline u64 math__bits__f64_bits(f64 f) { u64 p = *((u64*)(&f)); return p; } inline f64 math__bits__f64_from_bits(u64 b) { f64 p = *((f64*)(&b)); return p; } VV_LOC multi_return_u32_u32_u32 strconv__lsr96(u32 s2, u32 s1, u32 s0) { u32 r0 = ((u32)(0)); u32 r1 = ((u32)(0)); u32 r2 = ((u32)(0)); r0 = ((v__rshift_u32(s0, (u64)1)) | (v__lshift_u32(((s1 & ((u32)(1)))), (u64)31))); r1 = ((v__rshift_u32(s1, (u64)1)) | (v__lshift_u32(((s2 & ((u32)(1)))), (u64)31))); r2 = v__rshift_u32(s2, (u64)1); return (multi_return_u32_u32_u32){.arg0=r2, .arg1=r1, .arg2=r0}; } VV_LOC multi_return_u32_u32_u32 strconv__lsl96(u32 s2, u32 s1, u32 s0) { u32 r0 = ((u32)(0)); u32 r1 = ((u32)(0)); u32 r2 = ((u32)(0)); r2 = ((v__lshift_u32(s2, (u64)1)) | (v__rshift_u32(((s1 & (v__lshift_u32(((u32)(1)), (u64)31)))), (u64)31))); r1 = ((v__lshift_u32(s1, (u64)1)) | (v__rshift_u32(((s0 & (v__lshift_u32(((u32)(1)), (u64)31)))), (u64)31))); r0 = v__lshift_u32(s0, (u64)1); return (multi_return_u32_u32_u32){.arg0=r2, .arg1=r1, .arg2=r0}; } VV_LOC multi_return_u32_u32_u32 strconv__add96(u32 s2, u32 s1, u32 s0, u32 d2, u32 d1, u32 d0) { u64 w = ((u64)(0)); u32 r0 = ((u32)(0)); u32 r1 = ((u32)(0)); u32 r2 = ((u32)(0)); w = ((u64)(s0)) + ((u64)(d0)); r0 = ((u32)(w)); w = v__rshift_u64(w, (u64)32); w += ((u64)(s1)) + ((u64)(d1)); r1 = ((u32)(w)); w = v__rshift_u64(w, (u64)32); w += ((u64)(s2)) + ((u64)(d2)); r2 = ((u32)(w)); return (multi_return_u32_u32_u32){.arg0=r2, .arg1=r1, .arg2=r0}; } VV_LOC multi_return_strconv__ParserState_strconv__PrepNumber strconv__parser(string s) { int digx = 0; strconv__ParserState result = strconv__ParserState__ok; bool expneg = false; int expexp = 0; int i = 0; strconv__PrepNumber _t1 = ((strconv__PrepNumber){.negative = 0,.exponent = 0,.mantissa = 0,}); strconv__PrepNumber pn = _t1; for (;;) { if (!(i < s.len && builtin__u8_is_space(s.str[ i]))) break; i++; } if (s.str[ i] == '-') { pn.negative = true; i++; } if (s.str[ i] == '+') { i++; } for (;;) { if (!(i < s.len && builtin__u8_is_digit(s.str[ i]))) break; if (pn.mantissa == 0 && s.str[ i] == _const_strconv__c_zero) { i++; continue; } if (digx < 18) { pn.mantissa *= 10; pn.mantissa += ((u64)((rune)(s.str[ i] - _const_strconv__c_zero))); digx++; } else if (pn.exponent < 2147483647) { pn.exponent++; } i++; } if (i < s.len && s.str[ i] == '.') { i++; for (;;) { if (!(i < s.len && builtin__u8_is_digit(s.str[ i]))) break; if (pn.mantissa == 0 && s.str[ i] == _const_strconv__c_zero) { pn.exponent--; i++; continue; } if (digx < 18) { pn.mantissa *= 10; pn.mantissa += ((u64)((rune)(s.str[ i] - _const_strconv__c_zero))); pn.exponent--; digx++; } i++; } } if (i < s.len && (s.str[ i] == 'e' || s.str[ i] == 'E')) { i++; if (i < s.len) { if (s.str[ i] == _const_strconv__c_plus) { i++; } else if (s.str[ i] == _const_strconv__c_minus) { expneg = true; i++; } for (;;) { if (!(i < s.len && builtin__u8_is_digit(s.str[ i]))) break; if (expexp < 214748364) { expexp *= 10; expexp += ((int)((rune)(s.str[ i] - _const_strconv__c_zero))); } i++; } } } if (expneg) { expexp = -expexp; } pn.exponent += expexp; if (pn.mantissa == 0) { if (pn.negative) { result = strconv__ParserState__mzero; } else { result = strconv__ParserState__pzero; } } else if (pn.exponent > 309) { if (pn.negative) { result = strconv__ParserState__minf; } else { result = strconv__ParserState__pinf; } } else if (pn.exponent < -328) { if (pn.negative) { result = strconv__ParserState__mzero; } else { result = strconv__ParserState__pzero; } } if (i == 0 && s.len > 0) { return (multi_return_strconv__ParserState_strconv__PrepNumber){.arg0=strconv__ParserState__invalid_number, .arg1=pn}; } if (i != s.len) { return (multi_return_strconv__ParserState_strconv__PrepNumber){.arg0=strconv__ParserState__extra_char, .arg1=pn}; } return (multi_return_strconv__ParserState_strconv__PrepNumber){.arg0=result, .arg1=pn}; } VV_LOC u64 strconv__converter(strconv__PrepNumber* pn) { int binexp = 92; u32 s2 = ((u32)(0)); u32 s1 = ((u32)(0)); u32 s0 = ((u32)(0)); u32 q2 = ((u32)(0)); u32 q1 = ((u32)(0)); u32 q0 = ((u32)(0)); u32 r2 = ((u32)(0)); u32 r1 = ((u32)(0)); u32 r0 = ((u32)(0)); u32 mask28 = ((u32)(v__lshift_u64(((u64)(0xF)), (u64)28))); u64 result = ((u64)(0)); s0 = ((u32)((pn->mantissa & ((u64)(0x00000000FFFFFFFFU))))); s1 = ((u32)(v__rshift_u64(pn->mantissa, (u64)32))); s2 = ((u32)(0)); if (pn->mantissa == 0 && pn->exponent <= 0) { return (pn->negative ? (_const_strconv__double_minus_zero) : (_const_strconv__double_plus_zero)); } for (;;) { if (!(pn->exponent > 0)) break; multi_return_u32_u32_u32 mr_5881 = strconv__lsl96(s2, s1, s0); q2 = mr_5881.arg0; q1 = mr_5881.arg1; q0 = mr_5881.arg2; multi_return_u32_u32_u32 mr_5927 = strconv__lsl96(q2, q1, q0); r2 = mr_5927.arg0; r1 = mr_5927.arg1; r0 = mr_5927.arg2; multi_return_u32_u32_u32 mr_5983 = strconv__lsl96(r2, r1, r0); s2 = mr_5983.arg0; s1 = mr_5983.arg1; s0 = mr_5983.arg2; multi_return_u32_u32_u32 mr_6039 = strconv__add96(s2, s1, s0, q2, q1, q0); s2 = mr_6039.arg0; s1 = mr_6039.arg1; s0 = mr_6039.arg2; pn->exponent--; for (;;) { if (!(((s2 & mask28)) != 0)) break; multi_return_u32_u32_u32 mr_6162 = strconv__lsr96(s2, s1, s0); q2 = mr_6162.arg0; q1 = mr_6162.arg1; q0 = mr_6162.arg2; binexp++; s2 = q2; s1 = q1; s0 = q0; } } for (;;) { if (!(pn->exponent < 0)) break; for (;;) { if (!(!(((s2 & (v__lshift_u32(((u32)(1)), (u64)31)))) != 0))) break; multi_return_u32_u32_u32 mr_6309 = strconv__lsl96(s2, s1, s0); q2 = mr_6309.arg0; q1 = mr_6309.arg1; q0 = mr_6309.arg2; binexp--; s2 = q2; s1 = q1; s0 = q0; } q2 = VSAFE_DIV_u32(s2 , _const_strconv__c_ten); r1 = VSAFE_MOD_u32(s2 , _const_strconv__c_ten); r2 = ((v__rshift_u32(s1, (u64)8)) | (v__lshift_u32(r1, (u64)24))); q1 = VSAFE_DIV_u32(r2 , _const_strconv__c_ten); r1 = VSAFE_MOD_u32(r2 , _const_strconv__c_ten); r2 = (((v__lshift_u32(((s1 & ((u32)(0xFF)))), (u64)16)) | (v__rshift_u32(s0, (u64)16))) | (v__lshift_u32(r1, (u64)24))); r0 = VSAFE_DIV_u32(r2 , _const_strconv__c_ten); r1 = VSAFE_MOD_u32(r2 , _const_strconv__c_ten); q1 = ((v__lshift_u32(q1, (u64)8)) | (v__rshift_u32(((r0 & ((u32)(0x00FF0000)))), (u64)16))); q0 = v__lshift_u32(r0, (u64)16); r2 = (((s0 & ((u32)(0xFFFF)))) | (v__lshift_u32(r1, (u64)16))); q0 |= VSAFE_DIV_u32(r2 , _const_strconv__c_ten); s2 = q2; s1 = q1; s0 = q0; pn->exponent++; } if (s2 != 0 || s1 != 0 || s0 != 0) { for (;;) { if (!(((s2 & mask28)) == 0)) break; multi_return_u32_u32_u32 mr_6989 = strconv__lsl96(s2, s1, s0); q2 = mr_6989.arg0; q1 = mr_6989.arg1; q0 = mr_6989.arg2; binexp--; s2 = q2; s1 = q1; s0 = q0; } } if (binexp < -1022 && ((s2 | s1)) != 0) { int shift = -1022 - binexp; if (shift > 60) { return (pn->negative ? (_const_strconv__double_minus_zero) : (_const_strconv__double_plus_zero)); } u64 shifted = v__rshift_u64((((v__lshift_u64(((u64)(s2)), (u64)32)) | ((u64)(s1)))), (u64)((u32)(shift))); u64 q = (v__rshift_u64(shifted, (u64)8)) + (u64[]){(((v__rshift_u64(shifted, (u64)7)) & 1) != 0 && (((shifted & 0x7F)) != 0 || ((v__rshift_u64(shifted, (u64)8)) & 1) != 0))?1:0}[0]; return (((q & 0x000FFFFFFFFFFFFFLL)) | (v__lshift_u64((u64[]){(pn->negative)?1:0}[0], (u64)63))); } int nbit = 7; u32 check_round_bit = v__lshift_u32(((u32)(1)), (u64)((u32)(nbit))); u32 check_round_mask = v__lshift_u32(((u32)(0xFFFFFFFFU)), (u64)((u32)(nbit))); if (((s1 & check_round_bit)) != 0) { if (((s1 & ~check_round_mask)) != 0) { multi_return_u32_u32_u32 mr_9182 = strconv__add96(s2, s1, s0, 0, check_round_bit, 0); s2 = mr_9182.arg0; s1 = mr_9182.arg1; s0 = mr_9182.arg2; } else { if (((s1 & (v__lshift_u32(check_round_bit, (u64)((u32)(1)))))) != 0) { multi_return_u32_u32_u32 mr_9376 = strconv__add96(s2, s1, s0, 0, check_round_bit, 0); s2 = mr_9376.arg0; s1 = mr_9376.arg1; s0 = mr_9376.arg2; } } s1 = (s1 & check_round_mask); s0 = ((u32)(0)); if ((s2 & (v__lshift_u32(mask28, (u64)((u32)(1))))) != 0) { multi_return_u32_u32_u32 mr_9583 = strconv__lsr96(s2, s1, s0); q2 = mr_9583.arg0; q1 = mr_9583.arg1; q0 = mr_9583.arg2; binexp++; s2 = q2; s1 = q1; s0 = q0; } } binexp += 1023; if (binexp > 2046) { if (pn->negative) { result = _const_strconv__double_minus_infinity; } else { result = _const_strconv__double_plus_infinity; } } else if (binexp < 1) { if (pn->negative) { result = _const_strconv__double_minus_zero; } else { result = _const_strconv__double_plus_zero; } } else if (s2 != 0) { u64 q = ((u64)(0)); u64 binexs2 = v__lshift_u64(((u64)(binexp)), (u64)52); q = (((v__lshift_u64(((u64)((s2 & ~mask28))), (u64)24)) | (v__rshift_u64((((u64)(s1)) + ((u64)(128))), (u64)8))) | binexs2); if (pn->negative) { q |= (v__lshift_u64(((u64)(1)), (u64)63)); } result = q; } return result; } _result_f64 strconv__atof64(string s, strconv__AtoF64Param param) { if (s.len == 0) { return (_result_f64){ .is_error=true, .err=builtin___v_error(_S("expected a number found an empty string")), .data={E_STRUCT} }; } strconv__Float64u _t2 = ((strconv__Float64u){0}); strconv__Float64u res = _t2; multi_return_strconv__ParserState_strconv__PrepNumber mr_10868 = strconv__parser(s); strconv__ParserState res_parsing = mr_10868.arg0; strconv__PrepNumber pn = mr_10868.arg1; switch (res_parsing) { case strconv__ParserState__ok: { res.u = strconv__converter((voidptr)&pn); break; } case strconv__ParserState__pzero: { res.u = _const_strconv__double_plus_zero; break; } case strconv__ParserState__mzero: { res.u = _const_strconv__double_minus_zero; break; } case strconv__ParserState__pinf: { res.u = _const_strconv__double_plus_infinity; break; } case strconv__ParserState__minf: { res.u = _const_strconv__double_minus_infinity; break; } case strconv__ParserState__extra_char: { if (param.allow_extra_chars) { res.u = strconv__converter((voidptr)&pn); } else { return (_result_f64){ .is_error=true, .err=builtin___v_error(_S("extra char after number")), .data={E_STRUCT} }; } break; } case strconv__ParserState__invalid_number: { return (_result_f64){ .is_error=true, .err=builtin___v_error(_S("not a number")), .data={E_STRUCT} }; } } _result_f64 _t5; builtin___result_ok(&(f64[]) { res.f }, (_result*)(&_t5), sizeof(f64)); return _t5; } f64 strconv__atof_quick(string s) { strconv__Float64u _t1 = ((strconv__Float64u){0}); strconv__Float64u f = _t1; f64 sign = ((f64)(1.0)); int i = 0; for (;;) { if (!(i < s.len && s.str[ i] == ' ')) break; i++; } if (i < s.len) { if (s.str[ i] == '-') { sign = -1.0; i++; } else if (s.str[ i] == '+') { i++; } } if (s.str[ i] == 'i' && i + 2 < s.len && s.str[ i + 1] == 'n' && s.str[ i + 2] == 'f') { if (sign > ((f64)(0.0))) { f.u = _const_strconv__double_plus_infinity; } else { f.u = _const_strconv__double_minus_infinity; } return f.f; } for (;;) { if (!(i < s.len && s.str[ i] == '0')) break; i++; if (i >= s.len) { if (sign > ((f64)(0.0))) { f.u = _const_strconv__double_plus_zero; } else { f.u = _const_strconv__double_minus_zero; } return f.f; } } for (;;) { if (!(i < s.len && (s.str[ i] >= '0' && s.str[ i] <= '9'))) break; f.f *= ((f64)(10.0)); f.f += ((f64)((rune)(s.str[ i] - '0'))); i++; } if (i < s.len && s.str[ i] == '.') { i++; f64 frac_mul = ((f64)(0.1)); for (;;) { if (!(i < s.len && (s.str[ i] >= '0' && s.str[ i] <= '9'))) break; f.f += ((f64)((rune)(s.str[ i] - '0'))) * frac_mul; frac_mul *= ((f64)(0.1)); i++; } } if (i < s.len && (s.str[ i] == 'e' || s.str[ i] == 'E')) { i++; int exp = 0; int exp_sign = 1; if (i < s.len) { if (s.str[ i] == '-') { exp_sign = -1; i++; } else if (s.str[ i] == '+') { i++; } } for (;;) { if (!(i < s.len && s.str[ i] == '0')) break; i++; } for (;;) { if (!(i < s.len && (s.str[ i] >= '0' && s.str[ i] <= '9'))) break; exp *= 10; exp += ((int)((rune)(s.str[ i] - '0'))); i++; } if (exp_sign == 1) { if (exp > 309) { if (sign > 0) { f.u = _const_strconv__double_plus_infinity; } else { f.u = _const_strconv__double_minus_infinity; } return f.f; } strconv__Float64u _t5 = ((strconv__Float64u){.u = _const_strconv__pos_exp[exp],}); strconv__Float64u tmp_mul = _t5; f.f = f.f * tmp_mul.f; } else { if (exp > 324) { if (sign > 0) { f.u = _const_strconv__double_plus_zero; } else { f.u = _const_strconv__double_minus_zero; } return f.f; } strconv__Float64u _t7 = ((strconv__Float64u){.u = _const_strconv__neg_exp[exp],}); strconv__Float64u tmp_mul = _t7; f.f = f.f * tmp_mul.f; } } { // Unsafe block f.f = f.f * sign; return f.f; } return 0; } inline u8 strconv__byte_to_lower(u8 c) { return (c | 32); } _result_u64 strconv__common_parse_uint(string s, int _base, int _bit_size, bool error_on_non_digit, bool error_on_high_digit) { multi_return_u64_int mr_730 = strconv__common_parse_uint2(s, _base, _bit_size); u64 result = mr_730.arg0; int err = mr_730.arg1; if (err != 0 && (error_on_non_digit || error_on_high_digit)) { switch (err) { case -1: { return (_result_u64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(4, _MOV((string[4]){_S("common_parse_uint: wrong base "), builtin__int_str(_base), _S(" for "), s}))), .data={E_STRUCT} }; } case -2: { return (_result_u64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(4, _MOV((string[4]){_S("common_parse_uint: wrong bit size "), builtin__int_str(_bit_size), _S(" for "), s}))), .data={E_STRUCT} }; } case -3: { return (_result_u64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(2, _MOV((string[2]){_S("common_parse_uint: integer overflow "), s}))), .data={E_STRUCT} }; } default: { { return (_result_u64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(2, _MOV((string[2]){_S("common_parse_uint: syntax error "), s}))), .data={E_STRUCT} }; } } } } _result_u64 _t5; builtin___result_ok(&(u64[]) { result }, (_result*)(&_t5), sizeof(u64)); return _t5; } multi_return_u64_int strconv__common_parse_uint2(string s, int _base, int _bit_size) { if ((s).len == 0) { return (multi_return_u64_int){.arg0=((u64)(0)), .arg1=1}; } int bit_size = _bit_size; int base = _base; int start_index = 0; if (base == 0) { base = 10; if (s.str[ 0] == '0') { u8 ch = (s.len > 1 ? ((s.str[ 1] | 32)) : ('0')); if (s.len >= 3) { if (ch == 'b') { base = 2; start_index += 2; } else if (ch == 'o') { base = 8; start_index += 2; } else if (ch == 'x') { base = 16; start_index += 2; } if (s.str[ start_index] == '_') { start_index++; } } else if (s.len >= 2 && (s.str[ 1] >= '0' && s.str[ 1] <= '9')) { base = 10; start_index++; } else { base = 8; start_index++; } } } if (bit_size == 0) { bit_size = _const_strconv__int_size; } else if (bit_size < 0 || bit_size > 64) { return (multi_return_u64_int){.arg0=((u64)(0)), .arg1=-2}; } u64 cutoff = VSAFE_DIV_u64(_const_max_u64 , ((u64)(base))) + ((u64)(1)); u64 max_val = (bit_size == 64 ? (_const_max_u64) : ((v__lshift_u64(((u64)(1)), (u64)((u64)(bit_size)))) - ((u64)(1)))); int basem1 = base - 1; u64 n = ((u64)(0)); for (int i = start_index; i < s.len; ++i) { u8 c = s.str[ i]; if (c == '_') { if (i == start_index || i >= (s.len - 1)) { return (multi_return_u64_int){.arg0=((u64)(0)), .arg1=1}; } if (s.str[ i - 1] == '_' || s.str[ i + 1] == '_') { return (multi_return_u64_int){.arg0=((u64)(0)), .arg1=1}; } continue; } int sub_count = 0; c -= 48; if (c >= 17) { sub_count++; c -= 7; if (c >= 42) { sub_count++; c -= 32; } } if (c > basem1 || (sub_count == 0 && c > 9)) { return (multi_return_u64_int){.arg0=n, .arg1=i + 1}; } if (n >= cutoff) { return (multi_return_u64_int){.arg0=max_val, .arg1=-3}; } n *= ((u64)(base)); u64 n1 = n + ((u64)(c)); if (n1 < n || n1 > max_val) { return (multi_return_u64_int){.arg0=max_val, .arg1=-3}; } n = n1; } return (multi_return_u64_int){.arg0=n, .arg1=0}; } _result_u64 strconv__parse_uint(string s, int _base, int _bit_size) { return strconv__common_parse_uint(s, _base, _bit_size, true, true); } _result_i64 strconv__common_parse_int(string _s, int base, int _bit_size, bool error_on_non_digit, bool error_on_high_digit) { if ((_s).len == 0) { _result_i64 _t1; builtin___result_ok(&(i64[]) { ((i64)(0)) }, (_result*)(&_t1), sizeof(i64)); return _t1; } int bit_size = _bit_size; if (bit_size == 0) { bit_size = _const_strconv__int_size; } string s = _s; bool neg = false; if (s.str[ 0] == '+') { { // Unsafe block s = builtin__tos(s.str + 1, s.len - 1); } } else if (s.str[ 0] == '-') { neg = true; { // Unsafe block s = builtin__tos(s.str + 1, s.len - 1); } } _result_u64 _t2 = strconv__common_parse_uint(s, base, bit_size, error_on_non_digit, error_on_high_digit); if (_t2.is_error) { _result_i64 _t3 = {0}; _t3.is_error = true; _t3.err = _t2.err; return _t3; } u64 un = (*(u64*)_t2.data); if (un == 0) { _result_i64 _t4; builtin___result_ok(&(i64[]) { ((i64)(0)) }, (_result*)(&_t4), sizeof(i64)); return _t4; } u64 cutoff = v__lshift_u64(((u64)(1)), (u64)((u64)(bit_size - 1))); if (!neg && un >= cutoff) { if (error_on_high_digit) { return (_result_i64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(2, _MOV((string[2]){_S("common_parse_int: integer overflow "), _s}))), .data={E_STRUCT} }; } _result_i64 _t6; builtin___result_ok(&(i64[]) { ((i64)(cutoff - ((u64)(1)))) }, (_result*)(&_t6), sizeof(i64)); return _t6; } if (neg && un > cutoff) { if (error_on_high_digit) { return (_result_i64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(2, _MOV((string[2]){_S("common_parse_int: integer overflow "), _s}))), .data={E_STRUCT} }; } _result_i64 _t8; builtin___result_ok(&(i64[]) { -((i64)(cutoff)) }, (_result*)(&_t8), sizeof(i64)); return _t8; } _result_i64 _t10; /* if prepend */ if (neg) { builtin___result_ok(&(i64[]) { -((i64)(un)) }, (_result*)(&_t10), sizeof(i64)); goto _t11; }; { builtin___result_ok(&(i64[]) { ((i64)(un)) }, (_result*)(&_t10), sizeof(i64)); } _t11: {}; return _t10; } _result_i64 strconv__parse_int(string _s, int base, int _bit_size) { return strconv__common_parse_int(_s, base, _bit_size, true, false); } VV_LOC _result_multi_return_i64_int strconv__atoi_common_check(string s) { if ((s).len == 0) { return (_result_multi_return_i64_int){ .is_error=true, .err=builtin___v_error(_S("strconv.atoi: parsing \"\": empty string")), .data={E_STRUCT} }; } int start_idx = 0; i64 sign = ((i64)(1)); if (s.str[ 0] == '-' || s.str[ 0] == '+') { start_idx++; if (s.str[ 0] == '-') { sign = -1; } } if (s.len - start_idx < 1) { return (_result_multi_return_i64_int){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atoi: parsing \""), s, _S("\": no number after sign")}))), .data={E_STRUCT} }; } if (s.str[ start_idx] == '_' || s.str[ s.len - 1] == '_') { return (_result_multi_return_i64_int){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atoi: parsing \""), s, _S("\": values cannot start or end with underscores")}))), .data={E_STRUCT} }; } _result_multi_return_i64_int _t4; builtin___result_ok(&(multi_return_i64_int[]) { (multi_return_i64_int){.arg0=sign, .arg1=start_idx} }, (_result*)(&_t4), sizeof(multi_return_i64_int)); return _t4; } VV_LOC _result_i64 strconv__atoi_common(string s, i64 type_min, i64 type_max) { _result_multi_return_i64_int _t1 = strconv__atoi_common_check(s); if (_t1.is_error) { _result_i64 _t2 = {0}; _t2.is_error = true; _t2.err = _t1.err; return _t2; } multi_return_i64_int mr_7450 = (*(multi_return_i64_int*)_t1.data); i64 sign = mr_7450.arg0; int start_idx = mr_7450.arg1; i64 x = ((i64)(0)); bool underscored = false; for (int i = start_idx; i < s.len; ++i) { rune c = (rune)(s.str[ i] - '0'); if (c == 47) { if (underscored == true) { return (_result_i64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atoi: parsing \""), s, _S("\": consecutives underscores are not allowed")}))), .data={E_STRUCT} }; } underscored = true; continue; } else { if (c > 9) { return (_result_i64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atoi: parsing \""), s, _S("\": invalid radix 10 character")}))), .data={E_STRUCT} }; } underscored = false; x = (x * 10) + ((i64)(c * sign)); if (sign == 1 && x > type_max) { return (_result_i64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atoi: parsing \""), s, _S("\": integer overflow")}))), .data={E_STRUCT} }; } else { if (x < type_min) { return (_result_i64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atoi: parsing \""), s, _S("\": integer underflow")}))), .data={E_STRUCT} }; } } } } _result_i64 _t7; builtin___result_ok(&(i64[]) { x }, (_result*)(&_t7), sizeof(i64)); return _t7; } _result_int strconv__atoi(string s) { _result_i64 _t2 = strconv__atoi_common(s, _const_strconv__i64_min_int32, _const_strconv__i64_max_int32); if (_t2.is_error) { _result_int _t3 = {0}; _t3.is_error = true; _t3.err = _t2.err; return _t3; } _result_int _t1; builtin___result_ok(&(int[]) { ((int)((*(i64*)_t2.data))) }, (_result*)(&_t1), sizeof(int)); return _t1; } _result_i8 strconv__atoi8(string s) { _result_i64 _t2 = strconv__atoi_common(s, _const_min_i8, _const_max_i8); if (_t2.is_error) { _result_i8 _t3 = {0}; _t3.is_error = true; _t3.err = _t2.err; return _t3; } _result_i8 _t1; builtin___result_ok(&(i8[]) { ((i8)((*(i64*)_t2.data))) }, (_result*)(&_t1), sizeof(i8)); return _t1; } _result_i16 strconv__atoi16(string s) { _result_i64 _t2 = strconv__atoi_common(s, _const_min_i16, _const_max_i16); if (_t2.is_error) { _result_i16 _t3 = {0}; _t3.is_error = true; _t3.err = _t2.err; return _t3; } _result_i16 _t1; builtin___result_ok(&(i16[]) { ((i16)((*(i64*)_t2.data))) }, (_result*)(&_t1), sizeof(i16)); return _t1; } _result_i32 strconv__atoi32(string s) { _result_i64 _t2 = strconv__atoi_common(s, _const_min_i32, _const_max_i32); if (_t2.is_error) { _result_i32 _t3 = {0}; _t3.is_error = true; _t3.err = _t2.err; return _t3; } _result_i32 _t1; builtin___result_ok(&(i32[]) { ((i32)((*(i64*)_t2.data))) }, (_result*)(&_t1), sizeof(i32)); return _t1; } _result_i64 strconv__atoi64(string s) { _result_multi_return_i64_int _t1 = strconv__atoi_common_check(s); if (_t1.is_error) { _result_i64 _t2 = {0}; _t2.is_error = true; _t2.err = _t1.err; return _t2; } multi_return_i64_int mr_9202 = (*(multi_return_i64_int*)_t1.data); i64 sign = mr_9202.arg0; int start_idx = mr_9202.arg1; i64 x = ((i64)(0)); bool underscored = false; for (int i = start_idx; i < s.len; ++i) { rune c = (rune)(s.str[ i] - '0'); if (c == 47) { if (underscored == true) { return (_result_i64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atoi64: parsing \""), s, _S("\": consecutives underscores are not allowed")}))), .data={E_STRUCT} }; } underscored = true; continue; } else { if (c > 9) { return (_result_i64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atoi64: parsing \""), s, _S("\": invalid radix 10 character")}))), .data={E_STRUCT} }; } underscored = false; _result_i64 _t5 = strconv__safe_mul10_64bits(x); if (_t5.is_error) { IError _t6 = _t5.err; IError err = _t6; return (_result_i64){ .is_error=true, .err=builtin___v_error(builtin__str_intp(3, _MOV((StrIntpData[]){{_S("strconv.atoi64: parsing \""), 0xfe10, {.d_s = s}, 0, 0, 0}, {_S("\": "), 0xfe10, {.d_s = builtin__IError_str(err)}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}}))), .data={E_STRUCT} }; } x = (*(i64*)_t5.data); _result_i64 _t8 = strconv__safe_add_64bits(x, ((int)((i64)(c * sign)))); if (_t8.is_error) { IError _t9 = _t8.err; IError err = _t9; return (_result_i64){ .is_error=true, .err=builtin___v_error(builtin__str_intp(3, _MOV((StrIntpData[]){{_S("strconv.atoi64: parsing \""), 0xfe10, {.d_s = s}, 0, 0, 0}, {_S("\": "), 0xfe10, {.d_s = builtin__IError_str(err)}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}}))), .data={E_STRUCT} }; } x = (*(i64*)_t8.data); } } _result_i64 _t11; builtin___result_ok(&(i64[]) { x }, (_result*)(&_t11), sizeof(i64)); return _t11; } inline VV_LOC _result_i64 strconv__safe_add_64bits(i64 a, i64 b) { if (a > 0 && b > (_const_max_i64 - a)) { return (_result_i64){ .is_error=true, .err=builtin___v_error(_S("integer overflow")), .data={E_STRUCT} }; } else if (a < 0 && b < (_const_min_i64 - a)) { return (_result_i64){ .is_error=true, .err=builtin___v_error(_S("integer underflow")), .data={E_STRUCT} }; } _result_i64 _t3; builtin___result_ok(&(i64[]) { a + b }, (_result*)(&_t3), sizeof(i64)); return _t3; } inline VV_LOC _result_i64 strconv__safe_mul10_64bits(i64 a) { if (a > 0 && a > (VSAFE_DIV_i64(_const_max_i64 , 10))) { return (_result_i64){ .is_error=true, .err=builtin___v_error(_S("integer overflow")), .data={E_STRUCT} }; } if (a < 0 && a < (VSAFE_DIV_i64(_const_min_i64 , 10))) { return (_result_i64){ .is_error=true, .err=builtin___v_error(_S("integer underflow")), .data={E_STRUCT} }; } _result_i64 _t3; builtin___result_ok(&(i64[]) { a * 10 }, (_result*)(&_t3), sizeof(i64)); return _t3; } VV_LOC _result_int strconv__atou_common_check(string s) { if ((s).len == 0) { return (_result_int){ .is_error=true, .err=builtin___v_error(_S("strconv.atou: parsing \"\": empty string")), .data={E_STRUCT} }; } int start_idx = 0; if (s.str[ 0] == '-') { return (_result_int){ .is_error=true, .err=builtin___v_error(_S("strconv.atou: parsing \"{s}\" : negative value")), .data={E_STRUCT} }; } if (s.str[ 0] == '+') { start_idx++; } if (s.len - start_idx < 1) { return (_result_int){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atou: parsing \""), s, _S("\": no number after sign")}))), .data={E_STRUCT} }; } if (s.str[ start_idx] == '_' || s.str[ s.len - 1] == '_') { return (_result_int){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atou: parsing \""), s, _S("\": values cannot start or end with underscores")}))), .data={E_STRUCT} }; } _result_int _t5; builtin___result_ok(&(int[]) { start_idx }, (_result*)(&_t5), sizeof(int)); return _t5; } VV_LOC _result_u64 strconv__atou_common(string s, u64 type_max) { _result_int _t1 = strconv__atou_common_check(s); if (_t1.is_error) { _result_u64 _t2 = {0}; _t2.is_error = true; _t2.err = _t1.err; return _t2; } int start_idx = ((int)((*(int*)_t1.data))); u64 x = ((u64)(0)); bool underscored = false; for (int i = start_idx; i < s.len; ++i) { rune c = (rune)(s.str[ i] - '0'); if (c == 47) { if (underscored == true) { return (_result_u64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atou: parsing \""), s, _S("\": consecutives underscores are not allowed")}))), .data={E_STRUCT} }; } underscored = true; continue; } else { if (c > 9) { return (_result_u64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atou: parsing \""), s, _S("\": invalid radix 10 character")}))), .data={E_STRUCT} }; } underscored = false; if (x > VSAFE_DIV_u64(type_max , 10)) { return (_result_u64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atou: parsing \""), s, _S("\": integer overflow")}))), .data={E_STRUCT} }; } x *= 10; if (x > type_max - ((u64)(c))) { return (_result_u64){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(3, _MOV((string[3]){_S("strconv.atou: parsing \""), s, _S("\": integer overflow")}))), .data={E_STRUCT} }; } x += ((u64)(c)); } } _result_u64 _t7; builtin___result_ok(&(u64[]) { x }, (_result*)(&_t7), sizeof(u64)); return _t7; } _result_u8 strconv__atou8(string s) { _result_u64 _t2 = strconv__atou_common(s, _const_max_u8); if (_t2.is_error) { _result_u8 _t3 = {0}; _t3.is_error = true; _t3.err = _t2.err; return _t3; } _result_u8 _t1; builtin___result_ok(&(u8[]) { ((u8)((*(u64*)_t2.data))) }, (_result*)(&_t1), sizeof(u8)); return _t1; } _result_u16 strconv__atou16(string s) { _result_u64 _t2 = strconv__atou_common(s, _const_max_u16); if (_t2.is_error) { _result_u16 _t3 = {0}; _t3.is_error = true; _t3.err = _t2.err; return _t3; } _result_u16 _t1; builtin___result_ok(&(u16[]) { ((u16)((*(u64*)_t2.data))) }, (_result*)(&_t1), sizeof(u16)); return _t1; } _result_u32 strconv__atou(string s) { _result_u64 _t2 = strconv__atou_common(s, _const_max_u32); if (_t2.is_error) { _result_u32 _t3 = {0}; _t3.is_error = true; _t3.err = _t2.err; return _t3; } _result_u32 _t1; builtin___result_ok(&(u32[]) { ((u32)((*(u64*)_t2.data))) }, (_result*)(&_t1), sizeof(u32)); return _t1; } _result_u32 strconv__atou32(string s) { _result_u64 _t2 = strconv__atou_common(s, _const_max_u32); if (_t2.is_error) { _result_u32 _t3 = {0}; _t3.is_error = true; _t3.err = _t2.err; return _t3; } _result_u32 _t1; builtin___result_ok(&(u32[]) { ((u32)((*(u64*)_t2.data))) }, (_result*)(&_t1), sizeof(u32)); return _t1; } _result_u64 strconv__atou64(string s) { _result_u64 _t2 = strconv__atou_common(s, _const_max_u64); if (_t2.is_error) { _result_u64 _t3 = {0}; _t3.is_error = true; _t3.err = _t2.err; return _t3; } _result_u64 _t1; builtin___result_ok(&(u64[]) { ((u64)((*(u64*)_t2.data))) }, (_result*)(&_t1), sizeof(u64)); return _t1; } string strconv__Dec32_get_string_32(strconv__Dec32 d, bool neg, int i_n_digit, int i_pad_digit) { int n_digit = i_n_digit + 1; int pad_digit = i_pad_digit + 1; u32 out = d.m; int out_len = strconv__dec_digits(out); int out_len_original = out_len; int fw_zeros = 0; if (pad_digit > out_len) { fw_zeros = pad_digit - out_len; } Array_u8 buf = builtin____new_array_with_default(((int)(out_len + 5 + 1 + 1)), 0, sizeof(u8), 0); int i = 0; if (neg) { if (buf.data != 0) { ((u8*)buf.data)[i] = '-'; } i++; } int disp = 0; if (out_len <= 1) { disp = 1; } if (n_digit < out_len) { out += _const_strconv__ten_pow_table_32[out_len - n_digit - 1] * 5; out = VSAFE_DIV_u32(out,_const_strconv__ten_pow_table_32[out_len - n_digit]); out_len = n_digit; } int y = i + out_len; int x = 0; for (;;) { if (!(x < (out_len - disp - 1))) break; ((u8*)buf.data)[y - x] = (rune)('0' + ((u8)(VSAFE_MOD_u32(out , 10)))); out = VSAFE_DIV_u32(out,10); i++; x++; } if (i_n_digit == 0) { { // Unsafe block ((u8*)buf.data)[i] = 0; return builtin__tos(builtin__memdup(&((u8*)buf.data)[0], i + 1), i); } } if (out_len > 1 || fw_zeros > 0) { ((u8*)buf.data)[y - x] = '.'; i++; } x++; if (y - x >= 0) { ((u8*)buf.data)[y - x] = (rune)('0' + ((u8)(VSAFE_MOD_u32(out , 10)))); i++; } for (;;) { if (!(fw_zeros > 0)) break; ((u8*)buf.data)[i] = '0'; i++; fw_zeros--; } ((u8*)buf.data)[i] = 'e'; i++; int exp = d.e + out_len_original - 1; if (exp < 0) { ((u8*)buf.data)[i] = '-'; i++; exp = -exp; } else { ((u8*)buf.data)[i] = '+'; i++; } int d1 = VSAFE_MOD_int(exp , 10); int d0 = VSAFE_DIV_int(exp , 10); ((u8*)buf.data)[i] = (rune)('0' + ((u8)(d0))); i++; ((u8*)buf.data)[i] = (rune)('0' + ((u8)(d1))); i++; ((u8*)buf.data)[i] = 0; return builtin__tos(builtin__memdup(&((u8*)buf.data)[0], i + 1), i); } VV_LOC multi_return_strconv__Dec32_bool strconv__f32_to_decimal_exact_int(u32 i_mant, u32 exp) { strconv__Dec32 _t1 = ((strconv__Dec32){.m = 0,.e = 0,}); strconv__Dec32 d = _t1; u32 e = exp - 127; if (e > _const_strconv__mantbits32) { return (multi_return_strconv__Dec32_bool){.arg0=d, .arg1=false}; } u32 shift = _const_strconv__mantbits32 - e; u32 mant = (i_mant | 0x00800000); d.m = v__rshift_u32(mant, (u64)shift); if ((v__lshift_u32(d.m, (u64)shift)) != mant) { return (multi_return_strconv__Dec32_bool){.arg0=d, .arg1=false}; } for (;;) { if (!((VSAFE_MOD_u32(d.m , 10)) == 0)) break; d.m = VSAFE_DIV_u32(d.m,10); d.e++; } return (multi_return_strconv__Dec32_bool){.arg0=d, .arg1=true}; } VV_LOC strconv__Dec32 strconv__f32_to_decimal(u32 mant, u32 exp) { int e2 = 0; u32 m2 = ((u32)(0)); if (exp == 0) { e2 = -126 - ((int)(_const_strconv__mantbits32)) - 2; m2 = mant; } else { e2 = ((int)(exp)) - 127 - ((int)(_const_strconv__mantbits32)) - 2; m2 = ((v__lshift_u32(((u32)(1)), (u64)_const_strconv__mantbits32)) | mant); } bool even = ((m2 & 1)) == 0; bool accept_bounds = even; u32 mv = ((u32)(4 * m2)); u32 mp = ((u32)(4 * m2 + 2)); u32 mm_shift = strconv__bool_to_u32(mant != 0 || exp <= 1); u32 mm = ((u32)(4 * m2 - 1 - mm_shift)); u32 vr = ((u32)(0)); u32 vp = ((u32)(0)); u32 vm = ((u32)(0)); int e10 = 0; bool vm_is_trailing_zeros = false; bool vr_is_trailing_zeros = false; u8 last_removed_digit = ((u8)(0)); if (e2 >= 0) { u32 q = strconv__log10_pow2(e2); e10 = ((int)(q)); int k = 59 + strconv__pow5_bits(((int)(q))) - 1; int i = -e2 + ((int)(q)) + k; vr = strconv__mul_pow5_invdiv_pow2(mv, q, i); vp = strconv__mul_pow5_invdiv_pow2(mp, q, i); vm = strconv__mul_pow5_invdiv_pow2(mm, q, i); if (q != 0 && VSAFE_DIV_u32((vp - 1) , 10) <= VSAFE_DIV_u32(vm , 10)) { int l = 59 + strconv__pow5_bits(((int)(q - 1))) - 1; last_removed_digit = ((u8)(VSAFE_MOD_u32(strconv__mul_pow5_invdiv_pow2(mv, q - 1, -e2 + ((int)(q - 1)) + l) , 10))); } if (q <= 9) { if (VSAFE_MOD_u32(mv , 5) == 0) { vr_is_trailing_zeros = strconv__multiple_of_power_of_five_32(mv, q); } else if (accept_bounds) { vm_is_trailing_zeros = strconv__multiple_of_power_of_five_32(mm, q); } else if (strconv__multiple_of_power_of_five_32(mp, q)) { vp--; } } } else { u32 q = strconv__log10_pow5(-e2); e10 = ((int)(q)) + e2; int i = -e2 - ((int)(q)); int k = strconv__pow5_bits(i) - 61; int j = ((int)(q)) - k; vr = strconv__mul_pow5_div_pow2(mv, ((u32)(i)), j); vp = strconv__mul_pow5_div_pow2(mp, ((u32)(i)), j); vm = strconv__mul_pow5_div_pow2(mm, ((u32)(i)), j); if (q != 0 && (VSAFE_DIV_u32((vp - 1) , 10)) <= VSAFE_DIV_u32(vm , 10)) { j = ((int)(q)) - 1 - (strconv__pow5_bits(i + 1) - 61); last_removed_digit = ((u8)(VSAFE_MOD_u32(strconv__mul_pow5_div_pow2(mv, ((u32)(i + 1)), j) , 10))); } if (q <= 1) { vr_is_trailing_zeros = true; if (accept_bounds) { vm_is_trailing_zeros = mm_shift == 1; } else { vp--; } } else if (q < 31) { vr_is_trailing_zeros = strconv__multiple_of_power_of_two_32(mv, q - 1); } } int removed = 0; u32 out = ((u32)(0)); if (vm_is_trailing_zeros || vr_is_trailing_zeros) { for (;;) { if (!(VSAFE_DIV_u32(vp , 10) > VSAFE_DIV_u32(vm , 10))) break; vm_is_trailing_zeros = vm_is_trailing_zeros && (VSAFE_MOD_u32(vm , 10)) == 0; vr_is_trailing_zeros = vr_is_trailing_zeros && last_removed_digit == 0; last_removed_digit = ((u8)(VSAFE_MOD_u32(vr , 10))); vr = VSAFE_DIV_u32(vr,10); vp = VSAFE_DIV_u32(vp,10); vm = VSAFE_DIV_u32(vm,10); removed++; } if (vm_is_trailing_zeros) { for (;;) { if (!(VSAFE_MOD_u32(vm , 10) == 0)) break; vr_is_trailing_zeros = vr_is_trailing_zeros && last_removed_digit == 0; last_removed_digit = ((u8)(VSAFE_MOD_u32(vr , 10))); vr = VSAFE_DIV_u32(vr,10); vp = VSAFE_DIV_u32(vp,10); vm = VSAFE_DIV_u32(vm,10); removed++; } } if (vr_is_trailing_zeros && last_removed_digit == 5 && (VSAFE_MOD_u32(vr , 2)) == 0) { last_removed_digit = 4; } out = vr; if ((vr == vm && (!accept_bounds || !vm_is_trailing_zeros)) || last_removed_digit >= 5) { out++; } } else { for (;;) { if (!(VSAFE_DIV_u32(vp , 10) > VSAFE_DIV_u32(vm , 10))) break; last_removed_digit = ((u8)(VSAFE_MOD_u32(vr , 10))); vr = VSAFE_DIV_u32(vr,10); vp = VSAFE_DIV_u32(vp,10); vm = VSAFE_DIV_u32(vm,10); removed++; } out = vr + strconv__bool_to_u32(vr == vm || last_removed_digit >= 5); } return ((strconv__Dec32){.m = out,.e = e10 + removed,}); } string strconv__f32_to_str(f32 f, int n_digit) { strconv__Uf32 _t1 = ((strconv__Uf32){0}); strconv__Uf32 u1 = _t1; u1.f = f; u32 u = u1.u; bool neg = (v__rshift_u32(u, (u64)(_const_strconv__mantbits32 + _const_strconv__expbits32))) != 0; u32 mant = (u & ((v__lshift_u32(((u32)(1)), (u64)_const_strconv__mantbits32)) - ((u32)(1)))); u32 exp = ((v__rshift_u32(u, (u64)_const_strconv__mantbits32)) & ((v__lshift_u32(((u32)(1)), (u64)_const_strconv__expbits32)) - ((u32)(1)))); if (exp == 255 || (exp == 0 && mant == 0)) { return strconv__get_string_special(neg, exp == 0, mant == 0); } multi_return_strconv__Dec32_bool mr_8600 = strconv__f32_to_decimal_exact_int(mant, exp); strconv__Dec32 d = mr_8600.arg0; bool ok = mr_8600.arg1; if (!ok) { d = strconv__f32_to_decimal(mant, exp); } return strconv__Dec32_get_string_32(d, neg, n_digit, 0); } string strconv__f32_to_str_pad(f32 f, int n_digit) { strconv__Uf32 _t1 = ((strconv__Uf32){0}); strconv__Uf32 u1 = _t1; u1.f = f; u32 u = u1.u; bool neg = (v__rshift_u32(u, (u64)(_const_strconv__mantbits32 + _const_strconv__expbits32))) != 0; u32 mant = (u & ((v__lshift_u32(((u32)(1)), (u64)_const_strconv__mantbits32)) - ((u32)(1)))); u32 exp = ((v__rshift_u32(u, (u64)_const_strconv__mantbits32)) & ((v__lshift_u32(((u32)(1)), (u64)_const_strconv__expbits32)) - ((u32)(1)))); if (exp == 255 || (exp == 0 && mant == 0)) { return strconv__get_string_special(neg, exp == 0, mant == 0); } multi_return_strconv__Dec32_bool mr_9334 = strconv__f32_to_decimal_exact_int(mant, exp); strconv__Dec32 d = mr_9334.arg0; bool ok = mr_9334.arg1; if (!ok) { d = strconv__f32_to_decimal(mant, exp); } return strconv__Dec32_get_string_32(d, neg, n_digit, n_digit); } VV_LOC string strconv__Dec64_get_string_64(strconv__Dec64 d, bool neg, int i_n_digit, int i_pad_digit) { int n_digit = (i_n_digit < 1 ? (1) : (i_n_digit + 1)); int pad_digit = i_pad_digit + 1; u64 out = d.m; int d_exp = d.e; int out_len = strconv__dec_digits(out); int out_len_original = out_len; int fw_zeros = 0; if (pad_digit > out_len) { fw_zeros = pad_digit - out_len; } Array_u8 buf = builtin____new_array_with_default((out_len + 6 + 1 + 1 + fw_zeros), 0, sizeof(u8), 0); int i = 0; if (neg) { ((u8*)buf.data)[i] = '-'; i++; } int disp = 0; if (out_len <= 1) { disp = 1; } if (n_digit < out_len) { out += _const_strconv__ten_pow_table_64[out_len - n_digit - 1] * 5; out = VSAFE_DIV_u64(out,_const_strconv__ten_pow_table_64[out_len - n_digit]); u64 out_div = VSAFE_DIV_u64(d.m , _const_strconv__ten_pow_table_64[out_len - n_digit]); if (out_div < out && strconv__dec_digits(out_div) < strconv__dec_digits(out)) { d_exp++; n_digit++; } out_len = n_digit; } int y = i + out_len; int x = 0; for (;;) { if (!(x < (out_len - disp - 1))) break; ((u8*)buf.data)[y - x] = (rune)('0' + ((u8)(VSAFE_MOD_u64(out , 10)))); out = VSAFE_DIV_u64(out,10); i++; x++; } if (out_len > 1 || fw_zeros > 0) { ((u8*)buf.data)[y - x] = '.'; i++; } x++; if (y - x >= 0) { ((u8*)buf.data)[y - x] = (rune)('0' + ((u8)(VSAFE_MOD_u64(out , 10)))); i++; } for (;;) { if (!(fw_zeros > 0)) break; ((u8*)buf.data)[i] = '0'; i++; fw_zeros--; } ((u8*)buf.data)[i] = 'e'; i++; int exp = d_exp + out_len_original - 1; if (exp < 0) { ((u8*)buf.data)[i] = '-'; i++; exp = -exp; } else { ((u8*)buf.data)[i] = '+'; i++; } int d2 = VSAFE_MOD_int(exp , 10); exp = VSAFE_DIV_int(exp,10); int d1 = VSAFE_MOD_int(exp , 10); int d0 = VSAFE_DIV_int(exp , 10); if (d0 > 0) { ((u8*)buf.data)[i] = (rune)('0' + ((u8)(d0))); i++; } ((u8*)buf.data)[i] = (rune)('0' + ((u8)(d1))); i++; ((u8*)buf.data)[i] = (rune)('0' + ((u8)(d2))); i++; ((u8*)buf.data)[i] = 0; return builtin__tos(builtin__memdup(&((u8*)buf.data)[0], i + 1), i); } VV_LOC multi_return_strconv__Dec64_bool strconv__f64_to_decimal_exact_int(u64 i_mant, u64 exp) { strconv__Dec64 _t1 = ((strconv__Dec64){.m = 0,.e = 0,}); strconv__Dec64 d = _t1; u64 e = exp - 1023; if (e > _const_strconv__mantbits64) { return (multi_return_strconv__Dec64_bool){.arg0=d, .arg1=false}; } u64 shift = (u64)(_const_strconv__mantbits64 - e); u64 mant = (i_mant | ((u64)(0x0010000000000000LL))); d.m = v__rshift_u64(mant, (u64)shift); if ((v__lshift_u64(d.m, (u64)shift)) != mant) { return (multi_return_strconv__Dec64_bool){.arg0=d, .arg1=false}; } for (;;) { if (!((VSAFE_MOD_u64(d.m , 10)) == 0)) break; d.m = VSAFE_DIV_u64(d.m,10); d.e++; } return (multi_return_strconv__Dec64_bool){.arg0=d, .arg1=true}; } VV_LOC strconv__Dec64 strconv__f64_to_decimal(u64 mant, u64 exp) { int e2 = 0; u64 m2 = ((u64)(0)); if (exp == 0) { e2 = -1022 - ((int)(_const_strconv__mantbits64)) - 2; m2 = mant; } else { e2 = ((int)(exp)) - 1023 - ((int)(_const_strconv__mantbits64)) - 2; m2 = ((v__lshift_u64(((u64)(1)), (u64)_const_strconv__mantbits64)) | mant); } bool even = ((m2 & 1)) == 0; bool accept_bounds = even; u64 mv = ((u64)(4 * m2)); u64 mm_shift = strconv__bool_to_u64(mant != 0 || exp <= 1); u64 vr = ((u64)(0)); u64 vp = ((u64)(0)); u64 vm = ((u64)(0)); int e10 = 0; bool vm_is_trailing_zeros = false; bool vr_is_trailing_zeros = false; if (e2 >= 0) { u32 q = strconv__log10_pow2(e2) - strconv__bool_to_u32(e2 > 3); e10 = ((int)(q)); int k = 122 + strconv__pow5_bits(((int)(q))) - 1; int i = -e2 + ((int)(q)) + k; strconv__Uint128 mul = *(((strconv__Uint128*)(&_const_strconv__pow5_inv_split_64_x[builtin__v_fixed_index(q * 2, 584)]))); vr = strconv__mul_shift_64(((u64)(4)) * m2, mul, i); vp = strconv__mul_shift_64(((u64)(4)) * m2 + ((u64)(2)), mul, i); vm = strconv__mul_shift_64(((u64)(4)) * m2 - ((u64)(1)) - mm_shift, mul, i); if (q <= 21) { if (VSAFE_MOD_u64(mv , 5) == 0) { vr_is_trailing_zeros = strconv__multiple_of_power_of_five_64(mv, q); } else if (accept_bounds) { vm_is_trailing_zeros = strconv__multiple_of_power_of_five_64(mv - 1 - mm_shift, q); } else if (strconv__multiple_of_power_of_five_64(mv + 2, q)) { vp--; } } } else { u32 q = strconv__log10_pow5(-e2) - strconv__bool_to_u32(-e2 > 1); e10 = ((int)(q)) + e2; int i = -e2 - ((int)(q)); int k = strconv__pow5_bits(i) - 121; int j = ((int)(q)) - k; strconv__Uint128 mul = *(((strconv__Uint128*)(&_const_strconv__pow5_split_64_x[builtin__v_fixed_index(i * 2, 652)]))); vr = strconv__mul_shift_64(((u64)(4)) * m2, mul, j); vp = strconv__mul_shift_64(((u64)(4)) * m2 + ((u64)(2)), mul, j); vm = strconv__mul_shift_64(((u64)(4)) * m2 - ((u64)(1)) - mm_shift, mul, j); if (q <= 1) { vr_is_trailing_zeros = true; if (accept_bounds) { vm_is_trailing_zeros = (mm_shift == 1); } else { vp--; } } else if (q < 63) { vr_is_trailing_zeros = strconv__multiple_of_power_of_two_64(mv, q - 1); } } int removed = 0; u8 last_removed_digit = ((u8)(0)); u64 out = ((u64)(0)); if (vm_is_trailing_zeros || vr_is_trailing_zeros) { for (;;) { u64 vp_div_10 = VSAFE_DIV_u64(vp , 10); u64 vm_div_10 = VSAFE_DIV_u64(vm , 10); if (vp_div_10 <= vm_div_10) { break; } u64 vm_mod_10 = VSAFE_MOD_u64(vm , 10); u64 vr_div_10 = VSAFE_DIV_u64(vr , 10); u64 vr_mod_10 = VSAFE_MOD_u64(vr , 10); vm_is_trailing_zeros = vm_is_trailing_zeros && vm_mod_10 == 0; vr_is_trailing_zeros = vr_is_trailing_zeros && last_removed_digit == 0; last_removed_digit = ((u8)(vr_mod_10)); vr = vr_div_10; vp = vp_div_10; vm = vm_div_10; removed++; } if (vm_is_trailing_zeros) { for (;;) { u64 vm_div_10 = VSAFE_DIV_u64(vm , 10); u64 vm_mod_10 = VSAFE_MOD_u64(vm , 10); if (vm_mod_10 != 0) { break; } u64 vp_div_10 = VSAFE_DIV_u64(vp , 10); u64 vr_div_10 = VSAFE_DIV_u64(vr , 10); u64 vr_mod_10 = VSAFE_MOD_u64(vr , 10); vr_is_trailing_zeros = vr_is_trailing_zeros && last_removed_digit == 0; last_removed_digit = ((u8)(vr_mod_10)); vr = vr_div_10; vp = vp_div_10; vm = vm_div_10; removed++; } } if (vr_is_trailing_zeros && last_removed_digit == 5 && (VSAFE_MOD_u64(vr , 2)) == 0) { last_removed_digit = 4; } out = vr; if ((vr == vm && (!accept_bounds || !vm_is_trailing_zeros)) || last_removed_digit >= 5) { out++; } } else { bool round_up = false; for (;;) { if (!(VSAFE_DIV_u64(vp , 100) > VSAFE_DIV_u64(vm , 100))) break; round_up = (VSAFE_MOD_u64(vr , 100)) >= 50; vr = VSAFE_DIV_u64(vr,100); vp = VSAFE_DIV_u64(vp,100); vm = VSAFE_DIV_u64(vm,100); removed += 2; } for (;;) { if (!(VSAFE_DIV_u64(vp , 10) > VSAFE_DIV_u64(vm , 10))) break; round_up = (VSAFE_MOD_u64(vr , 10)) >= 5; vr = VSAFE_DIV_u64(vr,10); vp = VSAFE_DIV_u64(vp,10); vm = VSAFE_DIV_u64(vm,10); removed++; } out = vr + strconv__bool_to_u64(vr == vm || round_up); } return ((strconv__Dec64){.m = out,.e = e10 + removed,}); } string strconv__f64_to_str(f64 f, int n_digit) { strconv__Uf64 _t1 = ((strconv__Uf64){0}); strconv__Uf64 u1 = _t1; u1.f = f; u64 u = u1.u; bool neg = (v__rshift_u64(u, (u64)(_const_strconv__mantbits64 + _const_strconv__expbits64))) != 0; u64 mant = (u & ((v__lshift_u64(((u64)(1)), (u64)_const_strconv__mantbits64)) - ((u64)(1)))); u64 exp = ((v__rshift_u64(u, (u64)_const_strconv__mantbits64)) & ((v__lshift_u64(((u64)(1)), (u64)_const_strconv__expbits64)) - ((u64)(1)))); if (exp == 2047 || (exp == 0 && mant == 0)) { return strconv__get_string_special(neg, exp == 0, mant == 0); } multi_return_strconv__Dec64_bool mr_9595 = strconv__f64_to_decimal_exact_int(mant, exp); strconv__Dec64 d = mr_9595.arg0; bool ok = mr_9595.arg1; if (!ok) { d = strconv__f64_to_decimal(mant, exp); } return strconv__Dec64_get_string_64(d, neg, n_digit, 0); } string strconv__f64_to_str_pad(f64 f, int n_digit) { strconv__Uf64 _t1 = ((strconv__Uf64){0}); strconv__Uf64 u1 = _t1; u1.f = f; u64 u = u1.u; bool neg = (v__rshift_u64(u, (u64)(_const_strconv__mantbits64 + _const_strconv__expbits64))) != 0; u64 mant = (u & ((v__lshift_u64(((u64)(1)), (u64)_const_strconv__mantbits64)) - ((u64)(1)))); u64 exp = ((v__rshift_u64(u, (u64)_const_strconv__mantbits64)) & ((v__lshift_u64(((u64)(1)), (u64)_const_strconv__expbits64)) - ((u64)(1)))); if (exp == 2047 || (exp == 0 && mant == 0)) { return strconv__get_string_special(neg, exp == 0, mant == 0); } multi_return_strconv__Dec64_bool mr_10376 = strconv__f64_to_decimal_exact_int(mant, exp); strconv__Dec64 d = mr_10376.arg0; bool ok = mr_10376.arg1; if (!ok) { d = strconv__f64_to_decimal(mant, exp); } return strconv__Dec64_get_string_64(d, neg, n_digit, n_digit); } string strconv__format_str(string s, strconv__BF_param p) { if (p.len0 <= 0) { return builtin__string_clone(s); } int dif = p.len0 - builtin__utf8_str_visible_length(s); if (dif <= 0) { return builtin__string_clone(s); } strings__Builder res = strings__new_builder(s.len + dif); if (p.align == strconv__Align_text__right) { for (int i1 = 0; i1 < dif; i1++) { strings__Builder_write_u8(&res, p.pad_ch); } } strings__Builder_write_string(&res, s); if (p.align == strconv__Align_text__left) { for (int i1 = 0; i1 < dif; i1++) { strings__Builder_write_u8(&res, p.pad_ch); } } string _t3 = strings__Builder_str(&res); { // defer begin strings__Builder_free(&res); } // defer end return _t3; } void strconv__format_str_sb(string s, strconv__BF_param p, strings__Builder* sb) { if (p.len0 <= 0) { strings__Builder_write_string(sb, s); return; } int dif = p.len0 - builtin__utf8_str_visible_length(s); if (dif <= 0) { strings__Builder_write_string(sb, s); return; } if (p.align == strconv__Align_text__right) { for (int i1 = 0; i1 < dif; i1++) { strings__Builder_write_u8(sb, p.pad_ch); } } strings__Builder_write_string(sb, s); if (p.align == strconv__Align_text__left) { for (int i1 = 0; i1 < dif; i1++) { strings__Builder_write_u8(sb, p.pad_ch); } } } void strconv__format_dec_sb(u64 d, strconv__BF_param p, strings__Builder* res) { int n_char = strconv__dec_digits(d); int sign_len = (!p.positive || p.sign_flag ? (1) : (0)); int number_len = sign_len + n_char; int dif = p.len0 - number_len; bool sign_written = false; if (p.align == strconv__Align_text__right) { if (p.pad_ch == '0') { if (p.positive) { if (p.sign_flag) { strings__Builder_write_u8(res, '+'); sign_written = true; } } else { strings__Builder_write_u8(res, '-'); sign_written = true; } } for (int i1 = 0; i1 < dif; i1++) { strings__Builder_write_u8(res, p.pad_ch); } } if (!sign_written) { if (p.positive) { if (p.sign_flag) { strings__Builder_write_u8(res, '+'); } } else { strings__Builder_write_u8(res, '-'); } } Array_fixed_u8_32 buf = {0}; int i = 20; u64 n = d; u64 d_i = ((u64)(0)); if (n > 0) { for (;;) { if (!(n > 0)) break; u64 n1 = VSAFE_DIV_u64(n , 100); d_i = v__lshift_u64((n - (n1 * 100)), (u64)1); n = n1; { // Unsafe block buf[i] = _const_strconv__digit_pairs.str[d_i]; } i--; d_i++; { // Unsafe block buf[i] = _const_strconv__digit_pairs.str[d_i]; } i--; } i++; if (d_i < 20) { i++; } strings__Builder_write_ptr(res, &buf[i], n_char); } else { strings__Builder_write_u8(res, '0'); } if (p.align == strconv__Align_text__left) { for (int i1 = 0; i1 < dif; i1++) { strings__Builder_write_u8(res, p.pad_ch); } } return; } string strconv__f64_to_str_lnd1(f64 f, int dec_digit) { { // Unsafe block int clamped_dec = (dec_digit >= 36 ? (36 - 1) : (dec_digit)); string s = strconv__f64_to_str(f + _const_strconv__dec_round[clamped_dec], 18); if (s.len > 2 && (s.str[ 0] == 'n' || s.str[ 1] == 'i')) { return s; } bool m_sgn_flag = false; int sgn = 1; Array_fixed_u8_26 b = {0}; int d_pos = 1; int i = 0; int i1 = 0; int exp = 0; int exp_sgn = 1; int dot_res_sp = -1; for (int _t2 = 0; _t2 < s.len; ++_t2) { u8 c = s.str[_t2]; if (c == ('-')) { sgn = -1; i++; } else if (c == ('+')) { sgn = 1; i++; } else if ((c >= '0' && c <= '9')) { b[i1] = c; i1++; i++; } else if (c == ('.')) { if (sgn > 0) { d_pos = i; } else { d_pos = i - 1; } i++; } else if (c == ('e')) { i++; break; } else { builtin__string_free(&s); return _S("[Float conversion error!!]"); } } b[i1] = 0; if (s.str[ i] == '-') { exp_sgn = -1; i++; } else if (s.str[ i] == '+') { exp_sgn = 1; i++; } int c = i; for (;;) { if (!(c < s.len)) break; exp = exp * 10 + ((int)((rune)(s.str[ c] - '0'))); c++; } int extra_frac_digits = (dec_digit > 0 ? (dec_digit) : (0)); int sign_len = (sgn < 0 ? (1) : (0)); Array_u8 res = builtin____new_array_with_default(sign_len + i1 + exp + extra_frac_digits + 4, 0, sizeof(u8), &(u8[]){0}); int r_i = 0; builtin__string_free(&s); if (sgn == 1) { if (m_sgn_flag) { ((u8*)res.data)[r_i] = '+'; r_i++; } } else { ((u8*)res.data)[r_i] = '-'; r_i++; } i = 0; if (exp_sgn >= 0) { for (;;) { if (!(b[i] != 0)) break; ((u8*)res.data)[r_i] = b[i]; r_i++; i++; if (i >= d_pos && exp >= 0) { if (exp == 0) { dot_res_sp = r_i; ((u8*)res.data)[r_i] = '.'; r_i++; } exp--; } } for (;;) { if (!(exp >= 0)) break; ((u8*)res.data)[r_i] = '0'; r_i++; exp--; } } else { bool dot_p = true; for (;;) { if (!(exp > 0)) break; ((u8*)res.data)[r_i] = '0'; r_i++; exp--; if (dot_p) { dot_res_sp = r_i; ((u8*)res.data)[r_i] = '.'; r_i++; dot_p = false; } } for (;;) { if (!(b[i] != 0)) break; ((u8*)res.data)[r_i] = b[i]; r_i++; i++; } } if (dec_digit <= 0) { if (dot_res_sp < 0) { dot_res_sp = i + 1; } string tmp_res = builtin__string_clone(builtin__tos(res.data, dot_res_sp)); builtin__array_free(&res); return tmp_res; } if (dot_res_sp >= 0) { r_i = dot_res_sp + dec_digit + 1; ((u8*)res.data)[r_i] = 0; for (int c1 = 1; c1 < dec_digit + 1; ++c1) { if (((u8*)res.data)[(int)(r_i - c1)] == 0) { ((u8*)res.data)[(int)(r_i - c1)] = '0'; } } string tmp_res = builtin__string_clone(builtin__tos(res.data, r_i)); builtin__array_free(&res); return tmp_res; } else { if (dec_digit > 0) { int c1 = 0; ((u8*)res.data)[r_i] = '.'; r_i++; for (;;) { if (!(c1 < dec_digit)) break; ((u8*)res.data)[r_i] = '0'; r_i++; c1++; } ((u8*)res.data)[r_i] = 0; } string tmp_res = builtin__string_clone(builtin__tos(res.data, r_i)); builtin__array_free(&res); return tmp_res; } } return (string){.str=(byteptr)"", .is_lit=1}; } string strconv__format_fl(f64 f, strconv__BF_param p) { { // Unsafe block string fs = strconv__f64_to_str_lnd1((f >= ((f64)(0.0)) ? (f) : (-f)), p.len1); if (fs.str[ 0] == '[') { return fs; } if (p.rm_tail_zero) { string tmp = fs; fs = strconv__remove_tail_zeros(fs); builtin__string_free(&tmp); } Array_fixed_u8_512 buf = {0}; Array_fixed_u8_512 out = {0}; int buf_i = 0; int out_i = 0; int sign_len_diff = 0; if (p.pad_ch == '0') { if (p.positive) { if (p.sign_flag) { out[out_i] = '+'; out_i++; sign_len_diff = -1; } } else { out[out_i] = '-'; out_i++; sign_len_diff = -1; } } else { if (p.positive) { if (p.sign_flag) { buf[buf_i] = '+'; buf_i++; } } else { buf[buf_i] = '-'; buf_i++; } } builtin__vmemcpy(&buf[buf_i], fs.str, fs.len); buf_i += fs.len; int dif = p.len0 - buf_i + sign_len_diff; if (p.align == strconv__Align_text__right) { for (int i1 = 0; i1 < dif; i1++) { out[out_i] = p.pad_ch; out_i++; } } builtin__vmemcpy(&out[out_i], &buf[0], buf_i); out_i += buf_i; if (p.align == strconv__Align_text__left) { for (int i1 = 0; i1 < dif; i1++) { out[out_i] = p.pad_ch; out_i++; } } out[out_i] = 0; string tmp = fs; fs = builtin__tos_clone(&out[0]); builtin__string_free(&tmp); return fs; } return (string){.str=(byteptr)"", .is_lit=1}; } string strconv__format_es(f64 f, strconv__BF_param p) { { // Unsafe block string fs = strconv__f64_to_str_pad((f > 0 ? (f) : (-f)), p.len1); if (p.rm_tail_zero) { string tmp = fs; fs = strconv__remove_tail_zeros(fs); builtin__string_free(&tmp); } Array_fixed_u8_512 buf = {0}; Array_fixed_u8_512 out = {0}; int buf_i = 0; int out_i = 0; int sign_len_diff = 0; if (p.pad_ch == '0') { if (p.positive) { if (p.sign_flag) { out[out_i] = '+'; out_i++; sign_len_diff = -1; } } else { out[out_i] = '-'; out_i++; sign_len_diff = -1; } } else { if (p.positive) { if (p.sign_flag) { buf[buf_i] = '+'; buf_i++; } } else { buf[buf_i] = '-'; buf_i++; } } builtin__vmemcpy(&buf[buf_i], fs.str, fs.len); buf_i += fs.len; int dif = p.len0 - buf_i + sign_len_diff; if (p.align == strconv__Align_text__right) { for (int i1 = 0; i1 < dif; i1++) { out[out_i] = p.pad_ch; out_i++; } } builtin__vmemcpy(&out[out_i], &buf[0], buf_i); out_i += buf_i; if (p.align == strconv__Align_text__left) { for (int i1 = 0; i1 < dif; i1++) { out[out_i] = p.pad_ch; out_i++; } } out[out_i] = 0; string tmp = fs; fs = builtin__tos_clone(&out[0]); builtin__string_free(&tmp); return fs; } return (string){.str=(byteptr)"", .is_lit=1}; } string strconv__remove_tail_zeros(string s) { { // Unsafe block u8* buf = builtin__malloc_noscan(s.len + 1); int i_d = 0; int i_s = 0; for (;;) { if (!(i_s < s.len && !(s.str[ i_s] == '-' || s.str[ i_s] == '+') && (s.str[ i_s] > '9' || s.str[ i_s] < '0'))) break; buf[i_d] = s.str[ i_s]; i_s++; i_d++; } if (i_s < s.len && (s.str[ i_s] == '-' || s.str[ i_s] == '+')) { buf[i_d] = s.str[ i_s]; i_s++; i_d++; } for (;;) { if (!(i_s < s.len && s.str[ i_s] >= '0' && s.str[ i_s] <= '9')) break; buf[i_d] = s.str[ i_s]; i_s++; i_d++; } if (i_s < s.len && s.str[ i_s] == '.') { int i_s1 = i_s + 1; int sum = 0; int i_s2 = i_s1; for (;;) { if (!(i_s1 < s.len && s.str[ i_s1] >= '0' && s.str[ i_s1] <= '9')) break; sum += (s.str[ i_s1] - ((u8)('0'))); if (s.str[ i_s1] != '0') { i_s2 = i_s1; } i_s1++; } if (sum > 0) { for (int c_i = i_s; c_i < i_s2 + 1; ++c_i) { buf[i_d] = s.str[ c_i]; i_d++; } } i_s = i_s1; } if (i_s < s.len && s.str[ i_s] != '.') { for (;;) { buf[i_d] = s.str[ i_s]; i_s++; i_d++; if (i_s >= s.len) { break; } } } buf[i_d] = 0; return builtin__tos(buf, i_d); } return (string){.str=(byteptr)"", .is_lit=1}; } inline string strconv__ftoa_64(f64 f) { return strconv__f64_to_str(f, 17); } inline string strconv__ftoa_long_64(f64 f) { return strconv__f64_to_str_l(f); } inline string strconv__ftoa_32(f32 f) { return strconv__f32_to_str(f, 8); } inline string strconv__ftoa_long_32(f32 f) { return strconv__f32_to_str_l(f); } string strconv__format_int(i64 n, int radix) { { // Unsafe block if (radix < 2 || radix > 36) { builtin__panic_n(_S("invalid radix, it should be => 2 and <= 36, actual:"), radix); VUNREACHABLE(); } if (n == 0) { return _S("0"); } i64 n_copy = n; bool have_minus = false; if (n < 0) { have_minus = true; n_copy = -n_copy; } string res = _S(""); for (;;) { if (!(n_copy != 0)) break; string tmp_0 = res; int bdx = ((int)((i64)(VSAFE_MOD_i64(n_copy , radix)))); string tmp_1 = builtin__u8_ascii_str(_const_strconv__base_digits.str[ bdx]); res = builtin__string__plus(tmp_1, res); builtin__string_free(&tmp_0); builtin__string_free(&tmp_1); n_copy = VSAFE_DIV_i64(n_copy,radix); } if (have_minus) { string final_res = builtin__string__plus(_S("-"), res); builtin__string_free(&res); return final_res; } return res; } return (string){.str=(byteptr)"", .is_lit=1}; } string strconv__format_uint(u64 n, int radix) { { // Unsafe block if (radix < 2 || radix > 36) { builtin__panic_n(_S("invalid radix, it should be => 2 and <= 36, actual:"), radix); VUNREACHABLE(); } if (n == 0) { return _S("0"); } u64 n_copy = n; string res = _S(""); u64 uradix = ((u64)(radix)); for (;;) { if (!(n_copy != 0)) break; string tmp_0 = res; string tmp_1 = builtin__u8_ascii_str(_const_strconv__base_digits.str[ ((int)(VSAFE_MOD_u64(n_copy , uradix)))]); res = builtin__string__plus(tmp_1, res); builtin__string_free(&tmp_0); builtin__string_free(&tmp_1); n_copy = VSAFE_DIV_u64(n_copy,uradix); } return res; } return (string){.str=(byteptr)"", .is_lit=1}; } string strconv__f32_to_str_l(f32 f) { string s = strconv__f32_to_str(f, 8); string res = strconv__fxx_to_str_l_parse(s); builtin__string_free(&s); return res; } string strconv__f32_to_str_l_with_dot(f32 f) { string s = strconv__f32_to_str(f, 8); string res = strconv__fxx_to_str_l_parse_with_dot(s); builtin__string_free(&s); return res; } string strconv__f64_to_str_l(f64 f) { string s = strconv__f64_to_str(f, 18); string res = strconv__fxx_to_str_l_parse(s); builtin__string_free(&s); return res; } string strconv__f64_to_str_l_with_dot(f64 f) { string s = strconv__f64_to_str(f, 18); string res = strconv__fxx_to_str_l_parse_with_dot(s); builtin__string_free(&s); return res; } string strconv__fxx_to_str_l_parse(string s) { if (s.len > 2 && (s.str[ 0] == 'n' || s.str[ 1] == 'i')) { return builtin__string_clone(s); } bool m_sgn_flag = false; int sgn = 1; Array_fixed_u8_26 b = {0}; int d_pos = 1; int i = 0; int i1 = 0; int exp = 0; int exp_sgn = 1; for (int _t2 = 0; _t2 < s.len; ++_t2) { u8 c = s.str[_t2]; if (c == '-') { sgn = -1; i++; } else if (c == '+') { sgn = 1; i++; } else if (c >= '0' && c <= '9') { b[i1] = c; i1++; i++; } else if (c == '.') { if (sgn > 0) { d_pos = i; } else { d_pos = i - 1; } i++; } else if (c == 'e') { i++; break; } else { return _S("Float conversion error!!"); } } b[i1] = 0; if (s.str[ i] == '-') { exp_sgn = -1; i++; } else if (s.str[ i] == '+') { exp_sgn = 1; i++; } int c = i; for (;;) { if (!(c < s.len)) break; exp = exp * 10 + ((int)((rune)(s.str[ c] - '0'))); c++; } Array_u8 res = builtin____new_array_with_default(exp + 32, 0, sizeof(u8), &(u8[]){0}); int r_i = 0; if (sgn == 1) { if (m_sgn_flag) { ((u8*)res.data)[r_i] = '+'; r_i++; } } else { ((u8*)res.data)[r_i] = '-'; r_i++; } i = 0; if (exp_sgn >= 0) { for (;;) { if (!(b[i] != 0)) break; ((u8*)res.data)[r_i] = b[i]; r_i++; i++; if (i >= d_pos && exp >= 0) { if (exp == 0) { ((u8*)res.data)[r_i] = '.'; r_i++; } exp--; } } for (;;) { if (!(exp >= 0)) break; ((u8*)res.data)[r_i] = '0'; r_i++; exp--; } } else { bool dot_p = true; for (;;) { if (!(exp > 0)) break; ((u8*)res.data)[r_i] = '0'; r_i++; exp--; if (dot_p) { ((u8*)res.data)[r_i] = '.'; r_i++; dot_p = false; } } for (;;) { if (!(b[i] != 0)) break; ((u8*)res.data)[r_i] = b[i]; r_i++; i++; } } if (r_i > 1 && ((u8*)res.data)[r_i - 1] == '.') { ((u8*)res.data)[r_i] = '0'; r_i++; } else if (!(Array_u8_contains(res, '.'))) { ((u8*)res.data)[r_i] = '.'; r_i++; ((u8*)res.data)[r_i] = '0'; r_i++; } ((u8*)res.data)[r_i] = 0; string tmp_res = builtin__string_clone(builtin__tos(res.data, r_i)); builtin__array_free(&res); return tmp_res; } string strconv__fxx_to_str_l_parse_with_dot(string s) { if (s.len > 2 && (s.str[ 0] == 'n' || s.str[ 1] == 'i')) { return builtin__string_clone(s); } bool m_sgn_flag = false; int sgn = 1; Array_fixed_u8_26 b = {0}; int d_pos = 1; int i = 0; int i1 = 0; int exp = 0; int exp_sgn = 1; for (int _t2 = 0; _t2 < s.len; ++_t2) { u8 c = s.str[_t2]; if (c == '-') { sgn = -1; i++; } else if (c == '+') { sgn = 1; i++; } else if (c >= '0' && c <= '9') { b[i1] = c; i1++; i++; } else if (c == '.') { if (sgn > 0) { d_pos = i; } else { d_pos = i - 1; } i++; } else if (c == 'e') { i++; break; } else { return _S("Float conversion error!!"); } } b[i1] = 0; if (s.str[ i] == '-') { exp_sgn = -1; i++; } else if (s.str[ i] == '+') { exp_sgn = 1; i++; } int c = i; for (;;) { if (!(c < s.len)) break; exp = exp * 10 + ((int)((rune)(s.str[ c] - '0'))); c++; } Array_u8 res = builtin____new_array_with_default(exp + 32, 0, sizeof(u8), &(u8[]){0}); int r_i = 0; if (sgn == 1) { if (m_sgn_flag) { ((u8*)res.data)[r_i] = '+'; r_i++; } } else { ((u8*)res.data)[r_i] = '-'; r_i++; } i = 0; if (exp_sgn >= 0) { for (;;) { if (!(b[i] != 0)) break; ((u8*)res.data)[r_i] = b[i]; r_i++; i++; if (i >= d_pos && exp >= 0) { if (exp == 0) { ((u8*)res.data)[r_i] = '.'; r_i++; } exp--; } } for (;;) { if (!(exp >= 0)) break; ((u8*)res.data)[r_i] = '0'; r_i++; exp--; } } else { bool dot_p = true; for (;;) { if (!(exp > 0)) break; ((u8*)res.data)[r_i] = '0'; r_i++; exp--; if (dot_p) { ((u8*)res.data)[r_i] = '.'; r_i++; dot_p = false; } } for (;;) { if (!(b[i] != 0)) break; ((u8*)res.data)[r_i] = b[i]; r_i++; i++; } } if (r_i > 1 && ((u8*)res.data)[r_i - 1] == '.') { ((u8*)res.data)[r_i] = '0'; r_i++; } else if (!(Array_u8_contains(res, '.'))) { ((u8*)res.data)[r_i] = '.'; r_i++; ((u8*)res.data)[r_i] = '0'; r_i++; } ((u8*)res.data)[r_i] = 0; string tmp_res = builtin__string_clone(builtin__tos(res.data, r_i)); builtin__array_free(&res); return tmp_res; } inline VV_LOC u32 strconv__bool_to_u32(bool b) { if (b) { return ((u32)(1)); } return ((u32)(0)); } inline VV_LOC u64 strconv__bool_to_u64(bool b) { if (b) { return ((u64)(1)); } return ((u64)(0)); } VV_LOC string strconv__get_string_special(bool neg, bool expZero, bool mantZero) { if (!mantZero) { return _S("nan"); } if (!expZero) { if (neg) { return _S("-inf"); } else { return _S("+inf"); } } if (neg) { return _S("-0e+00"); } return _S("0e+00"); } VV_LOC u32 strconv__mul_shift_32(u32 m, u64 mul, int ishift) { multi_return_u64_u64 mr_750 = math__bits__mul_64(((u64)(m)), mul); u64 hi = mr_750.arg0; u64 lo = mr_750.arg1; u64 shifted_sum = (v__rshift_u64(lo, (u64)((u64)(ishift)))) + (v__lshift_u64(hi, (u64)((u64)(64 - ishift)))); ; return ((u32)(shifted_sum)); } inline VV_LOC u32 strconv__mul_pow5_invdiv_pow2(u32 m, u32 q, int j) { ; return strconv__mul_shift_32(m, _const_strconv__pow5_inv_split_32[q], j); } inline VV_LOC u32 strconv__mul_pow5_div_pow2(u32 m, u32 i, int j) { ; return strconv__mul_shift_32(m, _const_strconv__pow5_split_32[i], j); } VV_LOC u32 strconv__pow5_factor_32(u32 i_v) { u32 v = i_v; for (u32 n = ((u32)(0)); true; n++) { u32 q = VSAFE_DIV_u32(v , 5); u32 r = VSAFE_MOD_u32(v , 5); if (r != 0) { return n; } v = q; } return v; } VV_LOC bool strconv__multiple_of_power_of_five_32(u32 v, u32 p) { return strconv__pow5_factor_32(v) >= p; } VV_LOC bool strconv__multiple_of_power_of_two_32(u32 v, u32 p) { return ((u32)(math__bits__trailing_zeros_32(v))) >= p; } VV_LOC u32 strconv__log10_pow2(int e) { ; ; return v__rshift_u32((((u32)(e)) * 78913), (u64)18); } VV_LOC u32 strconv__log10_pow5(int e) { ; ; return v__rshift_u32((((u32)(e)) * 732923), (u64)20); } VV_LOC int strconv__pow5_bits(int e) { ; ; return ((int)((v__rshift_u32((((u32)(e)) * 1217359), (u64)19)) + 1)); } VV_LOC u64 strconv__shift_right_128(strconv__Uint128 v, int shift) { ; return ((v__lshift_u64(v.hi, (u64)((u64)(64 - shift)))) | (v__rshift_u64(v.lo, (u64)((u32)(shift))))); } VV_LOC u64 strconv__mul_shift_64(u64 m, strconv__Uint128 mul, int shift) { multi_return_u64_u64 mr_3253 = math__bits__mul_64(m, mul.hi); u64 hihi = mr_3253.arg0; u64 hilo = mr_3253.arg1; multi_return_u64_u64 mr_3288 = math__bits__mul_64(m, mul.lo); u64 lohi = mr_3288.arg0; strconv__Uint128 sum = ((strconv__Uint128){.lo = lohi + hilo,.hi = hihi,}); if (sum.lo < lohi) { sum.hi++; } return strconv__shift_right_128(sum, shift - 64); } VV_LOC u32 strconv__pow5_factor_64(u64 v_i) { u64 v = v_i; for (u32 n = ((u32)(0)); true; n++) { u64 q = VSAFE_DIV_u64(v , 5); u64 r = VSAFE_MOD_u64(v , 5); if (r != 0) { return n; } v = q; } return ((u32)(0)); } VV_LOC bool strconv__multiple_of_power_of_five_64(u64 v, u32 p) { return strconv__pow5_factor_64(v) >= p; } VV_LOC bool strconv__multiple_of_power_of_two_64(u64 v, u32 p) { return ((u32)(math__bits__trailing_zeros_64(v))) >= p; } int strconv__dec_digits(u64 n) { if (n <= 9999999999LL) { if (n <= 99999) { if (n <= 99) { if (n <= 9) { return 1; } else { return 2; } } else { if (n <= 999) { return 3; } else { if (n <= 9999) { return 4; } else { return 5; } } } } else { if (n <= 9999999) { if (n <= 999999) { return 6; } else { return 7; } } else { if (n <= 99999999) { return 8; } else { if (n <= 999999999) { return 9; } return 10; } } } } else { if (n <= 999999999999999LL) { if (n <= 999999999999LL) { if (n <= 99999999999LL) { return 11; } else { return 12; } } else { if (n <= 9999999999999LL) { return 13; } else { if (n <= 99999999999999LL) { return 14; } else { return 15; } } } } else { if (n <= 99999999999999999LL) { if (n <= 9999999999999999LL) { return 16; } else { return 17; } } else { if (n <= 999999999999999999LL) { return 18; } else { if (n <= 9999999999999999999ULL) { return 19; } return 20; } } } } return 0; } void strconv__v_printf(string str, Array_voidptr pt) { Array_voidptr _t1 = pt; Array_voidptr _t2 = builtin____new_array(0, _t1.len, sizeof(voidptr)); for (int _t3 = 0; _t3 < _t1.len; ++_t3) { voidptr _t4 = (*(voidptr*)builtin__array_get(_t1, _t3)); builtin__array_push((array*)&_t2, &_t4); } builtin__print(strconv__v_sprintf(str,_t2)); } string strconv__v_sprintf(string str, Array_voidptr pt) { strings__Builder res = strings__new_builder(pt.len * 16); int i = 0; int p_index = 0; bool sign = false; strconv__Align_text align = strconv__Align_text__right; int len0 = -1; int len1 = -1; int def_len1 = 6; u8 pad_ch = ((u8)(' ')); rune ch1 = '0'; rune ch2 = '0'; strconv__Char_parse_state status = strconv__Char_parse_state__norm_char; for (;;) { if (!(i < str.len)) break; if (status == strconv__Char_parse_state__reset_params) { sign = false; align = strconv__Align_text__right; len0 = -1; len1 = -1; pad_ch = ' '; status = strconv__Char_parse_state__norm_char; ch1 = '0'; ch2 = '0'; continue; } u8 ch = str.str[ i]; if (ch != '%' && status == strconv__Char_parse_state__norm_char) { strings__Builder_write_u8(&res, ch); i++; continue; } if (ch == '%' && status == strconv__Char_parse_state__field_char) { status = strconv__Char_parse_state__norm_char; strings__Builder_write_u8(&res, ch); i++; continue; } if (ch == '%' && status == strconv__Char_parse_state__norm_char) { status = strconv__Char_parse_state__field_char; i++; continue; } if (ch == 'c' && status == strconv__Char_parse_state__field_char) { strconv__v_sprintf_panic(p_index, pt.len); u8 d1 = ((u8)(*(((int*)(((voidptr*)pt.data)[p_index]))))); strings__Builder_write_u8(&res, d1); status = strconv__Char_parse_state__reset_params; p_index++; i++; continue; } if (ch == 'p' && status == strconv__Char_parse_state__field_char) { strconv__v_sprintf_panic(p_index, pt.len); strings__Builder_write_string(&res, _S("0x")); strings__Builder_write_string(&res, builtin__ptr_str(((voidptr*)pt.data)[p_index])); status = strconv__Char_parse_state__reset_params; p_index++; i++; continue; } if (status == strconv__Char_parse_state__field_char) { rune fc_ch1 = '0'; rune fc_ch2 = '0'; if ((i + 1) < str.len) { fc_ch1 = str.str[ i + 1]; if ((i + 2) < str.len) { fc_ch2 = str.str[ i + 2]; } } if (ch == '+') { sign = true; i++; continue; } else if (ch == '-') { align = strconv__Align_text__left; i++; continue; } else if (ch == '0' || ch == ' ') { if (align == strconv__Align_text__right) { pad_ch = ch; } i++; continue; } else if (ch == '\'') { i++; continue; } else if (ch == '.' && fc_ch1 >= '1' && fc_ch1 <= '9') { status = strconv__Char_parse_state__check_float; i++; continue; } else if (ch == '.' && fc_ch1 == '*' && fc_ch2 == 's') { strconv__v_sprintf_panic(p_index, pt.len); int len = *(((int*)(((voidptr*)pt.data)[p_index]))); p_index++; strconv__v_sprintf_panic(p_index, pt.len); string s = *(((string*)(((voidptr*)pt.data)[p_index]))); s = builtin__string_substr(s, 0, len); p_index++; strings__Builder_write_string(&res, s); status = strconv__Char_parse_state__reset_params; i += 3; continue; } status = strconv__Char_parse_state__len_set_start; continue; } if (status == strconv__Char_parse_state__len_set_start) { if (ch >= '1' && ch <= '9') { len0 = ((int)((rune)(ch - '0'))); status = strconv__Char_parse_state__len_set_in; i++; continue; } if (ch == '.') { status = strconv__Char_parse_state__check_float; i++; continue; } status = strconv__Char_parse_state__check_type; continue; } if (status == strconv__Char_parse_state__len_set_in) { if (ch >= '0' && ch <= '9') { len0 *= 10; len0 += ((int)((rune)(ch - '0'))); i++; continue; } if (ch == '.') { status = strconv__Char_parse_state__check_float; i++; continue; } status = strconv__Char_parse_state__check_type; continue; } if (status == strconv__Char_parse_state__check_float) { if (ch >= '0' && ch <= '9') { len1 = ((int)((rune)(ch - '0'))); status = strconv__Char_parse_state__check_float_in; i++; continue; } status = strconv__Char_parse_state__check_type; continue; } if (status == strconv__Char_parse_state__check_float_in) { if (ch >= '0' && ch <= '9') { len1 *= 10; len1 += ((int)((rune)(ch - '0'))); i++; continue; } status = strconv__Char_parse_state__check_type; continue; } if (status == strconv__Char_parse_state__check_type) { if (ch == 'l') { if (ch1 == '0') { ch1 = 'l'; i++; continue; } else { ch2 = 'l'; i++; continue; } } else if (ch == 'h') { if (ch1 == '0') { ch1 = 'h'; i++; continue; } else { ch2 = 'h'; i++; continue; } } else if (ch == 'd' || ch == 'i') { u64 d1 = ((u64)(0)); bool positive = true; if (ch1 == ('h')) { strconv__v_sprintf_panic(p_index, pt.len); int x = *(((int*)(((voidptr*)pt.data)[p_index]))); if (ch2 == 'h') { i8 sx = ((i8)(x)); positive = (sx >= 0 ? (true) : (false)); d1 = (positive ? (((u64)(sx))) : (((u64)(-sx)))); } else { i16 sx = ((i16)(x)); positive = (sx >= 0 ? (true) : (false)); d1 = (positive ? (((u64)(sx))) : (((u64)(-sx)))); } } else if (ch1 == ('l')) { strconv__v_sprintf_panic(p_index, pt.len); i64 x = *(((i64*)(((voidptr*)pt.data)[p_index]))); positive = (x >= 0 ? (true) : (false)); d1 = (positive ? (((u64)(x))) : (((u64)(-x)))); } else { strconv__v_sprintf_panic(p_index, pt.len); int x = *(((int*)(((voidptr*)pt.data)[p_index]))); positive = (x >= 0 ? (true) : (false)); d1 = (positive ? (((u64)(x))) : (((u64)(-x)))); } string tmp = strconv__format_dec_old(d1, ((strconv__BF_param){ .pad_ch = pad_ch, .len0 = len0, .len1 = 0, .positive = positive, .sign_flag = sign, .align = align, .rm_tail_zero = 0, })); strings__Builder_write_string(&res, tmp); builtin__string_free(&tmp); status = strconv__Char_parse_state__reset_params; p_index++; i++; ch1 = '0'; ch2 = '0'; continue; } else if (ch == 'u') { u64 d1 = ((u64)(0)); bool positive = true; strconv__v_sprintf_panic(p_index, pt.len); if (ch1 == ('h')) { int x = *(((int*)(((voidptr*)pt.data)[p_index]))); if (ch2 == 'h') { d1 = ((u64)(((u8)(x)))); } else { d1 = ((u64)(((u16)(x)))); } } else if (ch1 == ('l')) { d1 = ((u64)(*(((u64*)(((voidptr*)pt.data)[p_index]))))); } else { d1 = ((u64)(((u32)(*(((int*)(((voidptr*)pt.data)[p_index]))))))); } string tmp = strconv__format_dec_old(d1, ((strconv__BF_param){ .pad_ch = pad_ch, .len0 = len0, .len1 = 0, .positive = positive, .sign_flag = sign, .align = align, .rm_tail_zero = 0, })); strings__Builder_write_string(&res, tmp); builtin__string_free(&tmp); status = strconv__Char_parse_state__reset_params; p_index++; i++; continue; } else if (ch == 'x' || ch == 'X') { strconv__v_sprintf_panic(p_index, pt.len); string s = _S(""); if (ch1 == ('h')) { int x = *(((int*)(((voidptr*)pt.data)[p_index]))); if (ch2 == 'h') { s = builtin__i8_hex(((i8)(x))); } else { s = builtin__i16_hex(((i16)(x))); } } else if (ch1 == ('l')) { i64 x = *(((i64*)(((voidptr*)pt.data)[p_index]))); s = builtin__i64_hex(x); } else { int x = *(((int*)(((voidptr*)pt.data)[p_index]))); s = builtin__int_hex(x); } if (ch == 'X') { string tmp = s; s = builtin__string_to_upper(s); builtin__string_free(&tmp); } string tmp = strconv__format_str(s, ((strconv__BF_param){ .pad_ch = pad_ch, .len0 = len0, .len1 = 0, .positive = true, .sign_flag = false, .align = align, .rm_tail_zero = 0, })); strings__Builder_write_string(&res, tmp); builtin__string_free(&tmp); builtin__string_free(&s); status = strconv__Char_parse_state__reset_params; p_index++; i++; continue; } if (ch == 'f' || ch == 'F') { #if !defined(CUSTOM_DEFINE_nofloat) { strconv__v_sprintf_panic(p_index, pt.len); f64 x = *(((f64*)(((voidptr*)pt.data)[p_index]))); bool positive = x >= ((f64)(0.0)); len1 = (len1 >= 0 ? (len1) : (def_len1)); string s = strconv__format_fl_old(((f64)(x)), ((strconv__BF_param){ .pad_ch = pad_ch, .len0 = len0, .len1 = len1, .positive = positive, .sign_flag = sign, .align = align, .rm_tail_zero = 0, })); if (ch == 'F') { string tmp = builtin__string_to_upper(s); strings__Builder_write_string(&res, tmp); builtin__string_free(&tmp); } else { strings__Builder_write_string(&res, s); } builtin__string_free(&s); } #endif status = strconv__Char_parse_state__reset_params; p_index++; i++; continue; } else if (ch == 'e' || ch == 'E') { #if !defined(CUSTOM_DEFINE_nofloat) { strconv__v_sprintf_panic(p_index, pt.len); f64 x = *(((f64*)(((voidptr*)pt.data)[p_index]))); bool positive = x >= ((f64)(0.0)); len1 = (len1 >= 0 ? (len1) : (def_len1)); string s = strconv__format_es_old(((f64)(x)), ((strconv__BF_param){ .pad_ch = pad_ch, .len0 = len0, .len1 = len1, .positive = positive, .sign_flag = sign, .align = align, .rm_tail_zero = 0, })); if (ch == 'E') { string tmp = builtin__string_to_upper(s); strings__Builder_write_string(&res, tmp); builtin__string_free(&tmp); } else { strings__Builder_write_string(&res, s); } builtin__string_free(&s); } #endif status = strconv__Char_parse_state__reset_params; p_index++; i++; continue; } else if (ch == 'g' || ch == 'G') { #if !defined(CUSTOM_DEFINE_nofloat) { strconv__v_sprintf_panic(p_index, pt.len); f64 x = *(((f64*)(((voidptr*)pt.data)[p_index]))); bool positive = x >= ((f64)(0.0)); string s = _S(""); f64 tx = strconv__fabs(x); if (tx < ((f64)(999999.0)) && tx >= ((f64)(0.00001))) { len1 = (len1 >= 0 ? (len1 + 1) : (def_len1)); string tmp = s; s = strconv__format_fl_old(x, ((strconv__BF_param){ .pad_ch = pad_ch, .len0 = len0, .len1 = len1, .positive = positive, .sign_flag = sign, .align = align, .rm_tail_zero = true, })); builtin__string_free(&tmp); } else { len1 = (len1 >= 0 ? (len1 + 1) : (def_len1)); string tmp = s; s = strconv__format_es_old(x, ((strconv__BF_param){ .pad_ch = pad_ch, .len0 = len0, .len1 = len1, .positive = positive, .sign_flag = sign, .align = align, .rm_tail_zero = true, })); builtin__string_free(&tmp); } if (ch == 'G') { string tmp = builtin__string_to_upper(s); strings__Builder_write_string(&res, tmp); builtin__string_free(&tmp); } else { strings__Builder_write_string(&res, s); } builtin__string_free(&s); } #endif status = strconv__Char_parse_state__reset_params; p_index++; i++; continue; } else if (ch == 's') { strconv__v_sprintf_panic(p_index, pt.len); string s1 = *(((string*)(((voidptr*)pt.data)[p_index]))); pad_ch = ' '; string tmp = strconv__format_str(s1, ((strconv__BF_param){ .pad_ch = pad_ch, .len0 = len0, .len1 = 0, .positive = true, .sign_flag = false, .align = align, .rm_tail_zero = 0, })); strings__Builder_write_string(&res, tmp); builtin__string_free(&tmp); status = strconv__Char_parse_state__reset_params; p_index++; i++; continue; } } status = strconv__Char_parse_state__reset_params; p_index++; i++; } if (p_index != pt.len) { builtin__panic_n2(_S("% conversion specifiers number mismatch (expected %, given args)"), p_index, pt.len); VUNREACHABLE(); } string _t4 = strings__Builder_str(&res); { // defer begin strings__Builder_free(&res); } // defer end return _t4; } inline VV_LOC void strconv__v_sprintf_panic(int idx, int len) { if (idx >= len) { builtin__panic_n2(_S("% conversion specifiers number mismatch (expected %, given args)"), idx + 1, len); VUNREACHABLE(); } } VV_LOC f64 strconv__fabs(f64 x) { if (x < ((f64)(0.0))) { return -x; } return x; } string strconv__format_fl_old(f64 f, strconv__BF_param p) { { // Unsafe block string s = _S(""); string fs = strconv__f64_to_str_lnd1((f >= ((f64)(0.0)) ? (f) : (-f)), p.len1); if (fs.str[ 0] == '[') { builtin__string_free(&s); return fs; } if (p.rm_tail_zero) { string tmp = fs; fs = strconv__remove_tail_zeros_old(fs); builtin__string_free(&tmp); } strings__Builder res = strings__new_builder((p.len0 > fs.len ? (p.len0) : (fs.len))); int sign_len_diff = 0; if (p.pad_ch == '0') { if (p.positive) { if (p.sign_flag) { strings__Builder_write_u8(&res, '+'); sign_len_diff = -1; } } else { strings__Builder_write_u8(&res, '-'); sign_len_diff = -1; } string tmp = s; s = builtin__string_clone(fs); builtin__string_free(&tmp); } else { if (p.positive) { if (p.sign_flag) { string tmp = s; s = builtin__string__plus(_S("+"), fs); builtin__string_free(&tmp); } else { string tmp = s; s = builtin__string_clone(fs); builtin__string_free(&tmp); } } else { string tmp = s; s = builtin__string__plus(_S("-"), fs); builtin__string_free(&tmp); } } int dif = p.len0 - s.len + sign_len_diff; if (p.align == strconv__Align_text__right) { for (int i1 = 0; i1 < dif; i1++) { strings__Builder_write_u8(&res, p.pad_ch); } } strings__Builder_write_string(&res, s); if (p.align == strconv__Align_text__left) { for (int i1 = 0; i1 < dif; i1++) { strings__Builder_write_u8(&res, p.pad_ch); } } builtin__string_free(&s); builtin__string_free(&fs); string _t2 = strings__Builder_str(&res); { // defer begin strings__Builder_free(&res); } // defer end return _t2; { // defer begin strings__Builder_free(&res); } // defer end } return (string){.str=(byteptr)"", .is_lit=1}; } VV_LOC string strconv__format_es_old(f64 f, strconv__BF_param p) { { // Unsafe block string s = _S(""); string fs = strconv__f64_to_str_pad((f > 0 ? (f) : (-f)), p.len1); if (p.rm_tail_zero) { string tmp = fs; fs = strconv__remove_tail_zeros_old(fs); builtin__string_free(&tmp); } strings__Builder res = strings__new_builder((p.len0 > fs.len ? (p.len0) : (fs.len))); int sign_len_diff = 0; if (p.pad_ch == '0') { if (p.positive) { if (p.sign_flag) { strings__Builder_write_u8(&res, '+'); sign_len_diff = -1; } } else { strings__Builder_write_u8(&res, '-'); sign_len_diff = -1; } string tmp = s; s = builtin__string_clone(fs); builtin__string_free(&tmp); } else { if (p.positive) { if (p.sign_flag) { string tmp = s; s = builtin__string__plus(_S("+"), fs); builtin__string_free(&tmp); } else { string tmp = s; s = builtin__string_clone(fs); builtin__string_free(&tmp); } } else { string tmp = s; s = builtin__string__plus(_S("-"), fs); builtin__string_free(&tmp); } } int dif = p.len0 - s.len + sign_len_diff; if (p.align == strconv__Align_text__right) { for (int i1 = 0; i1 < dif; i1++) { strings__Builder_write_u8(&res, p.pad_ch); } } strings__Builder_write_string(&res, s); if (p.align == strconv__Align_text__left) { for (int i1 = 0; i1 < dif; i1++) { strings__Builder_write_u8(&res, p.pad_ch); } } string _t1 = strings__Builder_str(&res); { // defer begin strings__Builder_free(&res); builtin__string_free(&fs); builtin__string_free(&s); } // defer end return _t1; { // defer begin strings__Builder_free(&res); builtin__string_free(&fs); builtin__string_free(&s); } // defer end } return (string){.str=(byteptr)"", .is_lit=1}; } VV_LOC string strconv__remove_tail_zeros_old(string s) { int i = 0; int last_zero_start = -1; int dot_pos = -1; bool in_decimal = false; u8 prev_ch = ((u8)(0)); for (;;) { if (!(i < s.len)) break; u8 ch = s.str[i]; if (ch == '.') { in_decimal = true; dot_pos = i; } else if (in_decimal) { if (ch == '0' && prev_ch != '0') { last_zero_start = i; } else if (ch >= '1' && ch <= '9') { last_zero_start = -1; } else if (ch == 'e') { break; } } prev_ch = ch; i++; } string tmp = _S(""); if (last_zero_start > 0) { if (last_zero_start == dot_pos + 1) { tmp = builtin__string__plus(builtin__string_substr(s, 0, dot_pos), builtin__string_substr(s, i, 2147483647)); } else { tmp = builtin__string__plus(builtin__string_substr(s, 0, last_zero_start), builtin__string_substr(s, i, 2147483647)); } } else { tmp = builtin__string_clone(s); } if (tmp.str[tmp.len - 1] == '.') { return builtin__string_substr(tmp, 0, tmp.len - 1); } return tmp; } string strconv__format_dec_old(u64 d, strconv__BF_param p) { string s = _S(""); strings__Builder res = strings__new_builder(20); int sign_len_diff = 0; if (p.pad_ch == '0') { if (p.positive) { if (p.sign_flag) { strings__Builder_write_u8(&res, '+'); sign_len_diff = -1; } } else { strings__Builder_write_u8(&res, '-'); sign_len_diff = -1; } string tmp = s; s = builtin__u64_str(d); builtin__string_free(&tmp); } else { if (p.positive) { if (p.sign_flag) { string tmp = s; s = builtin__string__plus(_S("+"), builtin__u64_str(d)); builtin__string_free(&tmp); } else { string tmp = s; s = builtin__u64_str(d); builtin__string_free(&tmp); } } else { string tmp = s; s = builtin__string__plus(_S("-"), builtin__u64_str(d)); builtin__string_free(&tmp); } } int dif = p.len0 - s.len + sign_len_diff; if (p.align == strconv__Align_text__right) { for (int i1 = 0; i1 < dif; i1++) { strings__Builder_write_u8(&res, p.pad_ch); } } strings__Builder_write_string(&res, s); if (p.align == strconv__Align_text__left) { for (int i1 = 0; i1 < dif; i1++) { strings__Builder_write_u8(&res, p.pad_ch); } } string _t1 = strings__Builder_str(&res); { // defer begin strings__Builder_free(&res); builtin__string_free(&s); } // defer end return _t1; } int strconv__write_dec(i64 n, Array_u8* buf) { u64 mag = ((u64)(n)); if (n < 0) { mag = ((u64)(0)) - mag; int ndigits = strconv__dec_digits(mag); if (buf->len < ndigits + 1) { return -1; } ((u8*)buf->data)[0] = '-'; strconv__write_dec_u_digits(mag, buf, 1, ndigits); return ndigits + 1; } int ndigits = strconv__dec_digits(mag); if (buf->len < ndigits) { return -1; } strconv__write_dec_u_digits(mag, buf, 0, ndigits); return ndigits; } int strconv__write_dec_u(u64 n, Array_u8* buf) { int ndigits = strconv__dec_digits(n); if (buf->len < ndigits) { return -1; } strconv__write_dec_u_digits(n, buf, 0, ndigits); return ndigits; } VV_LOC void strconv__write_dec_u_digits(u64 n, Array_u8* buf, int offset, int ndigits) { u64 x = n; int i = offset + ndigits; for (;;) { i--; ((u8*)buf->data)[i] = (rune)(((u8)(VSAFE_MOD_u64(x , 10))) + '0'); x = VSAFE_DIV_u64(x,10); if (x == 0) { break; } } } VNORETURN VV_LOC void builtin___memory_panic(string fname, isize size) { v_memory_panic = true; builtin__eprint(fname); builtin__eprint(_S("(")); #if 0 { } #else { fprintf(stderr, "%p", ((voidptr)(size))); } #endif if (size < 0) { builtin__eprint(_S(" < 0")); } builtin__eprintln(_S(")")); builtin___v_panic(_S("memory allocation failure")); VUNREACHABLE(); while(1); } u8* builtin___v_malloc(isize n) { if (n < 0) { builtin___memory_panic(_S("malloc"), n); VUNREACHABLE(); } else if (n == 0) { return ((u8*)(((void*)0))); } u8* res = ((u8*)(((void*)0))); #if 0 { } #elif defined(CUSTOM_DEFINE_vgc) { } #elif defined(CUSTOM_DEFINE_gcboehm) { } #elif 0 { } #else { #if 0 { } #else { res = malloc(n); } #endif } #endif if (res == 0) { builtin___memory_panic(_S("malloc"), n); VUNREACHABLE(); } ; return res; } u8* builtin__malloc_noscan(isize n) { if (n < 0) { builtin___memory_panic(_S("malloc_noscan"), n); VUNREACHABLE(); } u8* res = ((u8*)(((void*)0))); #if 0 { } #elif defined(CUSTOM_DEFINE_vgc) { } #elif defined(CUSTOM_DEFINE_gcboehm) { } #elif 0 { } #else { #if 0 { } #else { res = malloc(n); } #endif } #endif if (res == 0) { builtin___memory_panic(_S("malloc_noscan"), n); VUNREACHABLE(); } ; return res; } VV_LOC u8* builtin__malloc_uninit(isize n) { if (n < 0) { builtin___memory_panic(_S("malloc_uninit"), n); VUNREACHABLE(); } else if (n == 0) { return ((u8*)(((void*)0))); } return builtin___v_malloc(n); } inline VV_LOC u64 builtin____at_least_one(u64 how_many) { if (how_many == 0) { return 1; } return how_many; } u8* builtin__malloc_uncollectable(isize n) { if (n < 0) { builtin___memory_panic(_S("malloc_uncollectable"), n); VUNREACHABLE(); } u8* res = ((u8*)(((void*)0))); #if 0 { } #elif defined(CUSTOM_DEFINE_vgc) { } #elif defined(CUSTOM_DEFINE_gcboehm) { } #elif 0 { } #else { #if 0 { } #else { res = malloc(n); } #endif } #endif if (res == 0) { builtin___memory_panic(_S("malloc_uncollectable"), n); VUNREACHABLE(); } ; return res; } u8* builtin__v_realloc(u8* b, isize n) { u8* new_ptr = ((u8*)(((void*)0))); #if 0 { } #elif defined(CUSTOM_DEFINE_vgc) { } #elif defined(CUSTOM_DEFINE_gcboehm) { } #else { #if 0 { } #else { new_ptr = realloc(b, n); } #endif } #endif if (new_ptr == 0) { builtin___memory_panic(_S("v_realloc"), n); VUNREACHABLE(); } if (b != ((void*)0)) { ; } ; return new_ptr; } u8* builtin__realloc_data(u8* old_data, int old_size, int new_size) { u8* nptr = ((u8*)(((void*)0))); #if defined(CUSTOM_DEFINE_vgc) { } #elif defined(CUSTOM_DEFINE_gcboehm) { } #else { #if 0 { } #else { nptr = realloc(old_data, new_size); } #endif } #endif if (nptr == 0) { builtin___memory_panic(_S("realloc_data"), ((isize)(new_size))); VUNREACHABLE(); } if (old_data != ((void*)0)) { ; } ; return nptr; } u8* builtin__vcalloc(isize n) { if (n < 0) { builtin___memory_panic(_S("vcalloc"), n); VUNREACHABLE(); } else if (n == 0) { return ((u8*)(((void*)0))); } #if 0 { } #elif defined(CUSTOM_DEFINE_vgc) { } #elif defined(CUSTOM_DEFINE_gcboehm) { } #else { #if 0 { } #else { voidptr r = calloc(1, n); ; return r; } #endif } #endif return ((u8*)(((void*)0))); } u8* builtin__vcalloc_noscan(isize n) { #if 0 { } #elif defined(CUSTOM_DEFINE_vgc) { } #elif defined(CUSTOM_DEFINE_gcboehm) { } #else { return builtin__vcalloc(n); } #endif return ((u8*)(((void*)0))); } void builtin___v_free(voidptr ptr) { if (ptr == 0) { return; } IError* none_err = ((IError*)(&_const_none__)); if (ptr == none_err->_object) { return; } IError* sentinel_err = ((IError*)(&_const_error_sentinel)); if (ptr == sentinel_err->_object) { return; } #if 0 { } #elif defined(CUSTOM_DEFINE_vgc) { } #elif defined(CUSTOM_DEFINE_gcboehm) { } #else { ; #if 0 { } #else { free(ptr); } #endif } #endif } voidptr builtin__memdup(voidptr src, isize sz) { if (sz == 0) { return builtin__vcalloc(1); } { // Unsafe block u8* mem = builtin___v_malloc(sz); return memcpy(mem, src, sz); } return 0; } voidptr builtin__memdup_noscan(voidptr src, isize sz) { if (sz == 0) { return builtin__vcalloc_noscan(1); } { // Unsafe block u8* mem = builtin__malloc_noscan(sz); return memcpy(mem, src, sz); } return 0; } voidptr builtin__memdup_uncollectable(voidptr src, isize sz) { if (sz == 0) { return builtin__vcalloc(1); } { // Unsafe block u8* mem = builtin__malloc_uncollectable(sz); return memcpy(mem, src, sz); } return 0; } voidptr builtin__memdup_align(voidptr src, isize sz, isize align) { if (sz == 0) { return builtin__vcalloc(1); } isize n = sz; if (n < 0) { builtin___memory_panic(_S("memdup_align"), n); VUNREACHABLE(); } u8* res = ((u8*)(((void*)0))); #if 0 { } #elif defined(CUSTOM_DEFINE_gcboehm) { } #elif 0 { } #else { #if 0 { } #else { res = aligned_alloc(align, n); } #endif } #endif if (res == 0) { builtin___memory_panic(_S("memdup_align"), n); VUNREACHABLE(); } ; return memcpy(res, src, sz); } GCHeapUsage builtin__gc_heap_usage(void) { #if defined(CUSTOM_DEFINE_vgc) { } #elif defined(CUSTOM_DEFINE_gcboehm) { } #else { return ((GCHeapUsage){.heap_size = 0,.free_bytes = 0,.total_bytes = 0,.unmapped_bytes = 0,.bytes_since_gc = 0,}); } #endif return (GCHeapUsage){0}; } usize builtin__gc_memory_use(void) { #if defined(CUSTOM_DEFINE_vgc) { } #elif defined(CUSTOM_DEFINE_gcboehm) { } #else { return 0; } #endif return 0; } inline VV_LOC int builtin__array_data_header_size(void) { return ((int)(sizeof(voidptr))); } inline VV_LOC u64 builtin__array_data_allocation_size(u64 total_size) { return ((u64)(builtin__array_data_header_size())) + builtin____at_least_one(total_size); } inline VV_LOC voidptr builtin__alloc_array_data(u64 total_size) { u8* raw = builtin__vcalloc(builtin__array_data_allocation_size(total_size)); return ((u8*)(raw)) + builtin__array_data_header_size(); } inline VV_LOC voidptr builtin__alloc_array_data_uninit(u64 total_size) { u8* raw = builtin__malloc_uninit(builtin__array_data_allocation_size(total_size)); { // Unsafe block (((ArrayDataHeader*)(raw)))->has_slices = false; return ((u8*)(raw)) + builtin__array_data_header_size(); } return 0; } inline VV_LOC bool builtin__array_uses_noscan_data(array a) { return builtin__ArrayFlags_has(&a.flags, ArrayFlags__noscan_data); } inline VV_LOC voidptr builtin__array_alloc_array_data_like(array a, u64 total_size) { return builtin__alloc_array_data(total_size); } inline VV_LOC voidptr builtin__array_alloc_array_data_like_uninit(array a, u64 total_size) { return builtin__alloc_array_data_uninit(total_size); } inline VV_LOC ArrayDataHeader* builtin__array_data_header(array a) { if (!builtin__ArrayFlags_has(&a.flags, ArrayFlags__managed) || a.data == ((void*)0)) { return ((void*)0); } u8* base_data = ((u8*)(a.data)) - ((u64)(a.offset)); return ((ArrayDataHeader*)(base_data - builtin__array_data_header_size())); } inline VV_LOC bool builtin__array_buffer_has_slices(array a) { if (!builtin__ArrayFlags_has(&a.flags, ArrayFlags__managed) || a.data == ((void*)0)) { return false; } ArrayDataHeader* header = builtin__array_data_header(a); if (header == ((void*)0)) { return false; } return header->has_slices; } inline VV_LOC void builtin__array_mark_buffer_has_slices(array* a) { if (!builtin__ArrayFlags_has(&a->flags, ArrayFlags__managed) || a->data == ((void*)0)) { return; } { // Unsafe block u8* base_data = ((u8*)(a->data)) - ((u64)(a->offset)); ArrayDataHeader* header = ((ArrayDataHeader*)(base_data - builtin__array_data_header_size())); if (!header->has_slices) { header->has_slices = true; } } } inline VV_LOC void builtin__array_set_managed_flags(array* a, bool is_slice) { { // Unsafe block builtin__ArrayFlags_set(&a->flags, ArrayFlags__managed); if (is_slice) { builtin__ArrayFlags_set(&a->flags, ArrayFlags__is_slice); } else { builtin__ArrayFlags_clear(&a->flags, ArrayFlags__is_slice); } } } inline VV_LOC void builtin__array_clone_shallow_to_cap(array* a, int new_cap) { if (new_cap <= 0) { builtin__ArrayFlags_clear(&a->flags, ((ArrayFlags__managed | ArrayFlags__noscan_data) | ArrayFlags__is_slice)); a->data = ((void*)0); a->offset = 0; a->cap = 0; return; } bool use_noscan_data = builtin__array_uses_noscan_data(*a); u64 total_size = ((u64)(new_cap)) * ((u64)(a->element_size)); voidptr new_data = builtin__array_alloc_array_data_like_uninit(*a, total_size); u64 copy_size = ((u64)(a->len)) * ((u64)(a->element_size)); if (a->data != ((void*)0) && copy_size > 0) { builtin__vmemcpy(new_data, a->data, copy_size); } a->data = new_data; a->offset = 0; a->cap = new_cap; { // Unsafe block if (use_noscan_data) { builtin__ArrayFlags_set(&a->flags, ArrayFlags__noscan_data); } else { builtin__ArrayFlags_clear(&a->flags, ArrayFlags__noscan_data); } } builtin__array_set_managed_flags(a, false); } inline VV_LOC int builtin__v_ni_index(int i, int len) { return (i < 0 ? (len + i) : (i)); } VV_LOC array builtin____new_array(int mylen, int cap, int elm_size) { builtin__panic_on_negative_len(mylen); builtin__panic_on_negative_cap(cap); int cap_ = (cap < mylen ? (mylen) : (cap)); u64 total_size = ((u64)(cap_)) * ((u64)(elm_size)); voidptr data = ((void*)0); if (cap_ > 0 && mylen == 0) { data = builtin__alloc_array_data_uninit(total_size); } else if (cap_ > 0) { data = builtin__alloc_array_data(total_size); } array _t1 = ((array){.data = (voidptr)data,.offset = 0,.len = mylen,.cap = cap_,.flags = ArrayFlags__managed,.element_size = elm_size,}); array arr = _t1; return arr; } VV_LOC array builtin____new_array_with_default(int mylen, int cap, int elm_size, voidptr val) { builtin__panic_on_negative_len(mylen); builtin__panic_on_negative_cap(cap); int cap_ = (cap < mylen ? (mylen) : (cap)); array _t1 = ((array){.data = 0,.offset = 0,.len = mylen,.cap = cap_,.flags = ArrayFlags__managed,.element_size = elm_size,}); array arr = _t1; u64 total_size = ((u64)(cap_)) * ((u64)(elm_size)); if (cap_ > 0 && mylen == 0) { arr.data = builtin__alloc_array_data_uninit(total_size); } else if (cap_ > 0) { arr.data = builtin__alloc_array_data(total_size); } if (val != 0) { u8* eptr = ((u8*)(arr.data)); { // Unsafe block if (eptr != ((void*)0)) { if (arr.element_size == 1) { u8 byte_value = *(((u8*)(val))); for (int i = 0; i < arr.len; ++i) { eptr[i] = byte_value; } } else { for (int _t2 = 0; _t2 < arr.len; ++_t2) { builtin__vmemcpy(eptr, val, arr.element_size); eptr += arr.element_size; } } } } } return arr; } VV_LOC array builtin____new_array_with_multi_default(int mylen, int cap, int elm_size, voidptr val) { builtin__panic_on_negative_len(mylen); builtin__panic_on_negative_cap(cap); int cap_ = (cap < mylen ? (mylen) : (cap)); array _t1 = ((array){.data = 0,.offset = 0,.len = mylen,.cap = cap_,.flags = ArrayFlags__managed,.element_size = elm_size,}); array arr = _t1; u64 total_size = ((u64)(cap_)) * ((u64)(elm_size)); if (cap_ > 0) { arr.data = builtin__alloc_array_data(total_size); } if (val != 0) { u8* eptr = ((u8*)(arr.data)); { // Unsafe block if (eptr != ((void*)0)) { for (int i = 0; i < arr.len; ++i) { builtin__vmemcpy(eptr, ((charptr)(val)) + (int)(i * arr.element_size), arr.element_size); eptr += arr.element_size; } } } } return arr; } VV_LOC array builtin____new_array_with_array_default(int mylen, int cap, int elm_size, array val, int depth) { builtin__panic_on_negative_len(mylen); builtin__panic_on_negative_cap(cap); int cap_ = (cap < mylen ? (mylen) : (cap)); array _t1 = ((array){.data = 0,.offset = 0,.len = mylen,.cap = cap_,.flags = ArrayFlags__managed,.element_size = elm_size,}); array arr = _t1; if (cap_ > 0) { arr.data = builtin__alloc_array_data(((u64)(cap_)) * ((u64)(elm_size))); } u8* eptr = ((u8*)(arr.data)); { // Unsafe block if (eptr != ((void*)0)) { for (int _t2 = 0; _t2 < arr.len; ++_t2) { array val_clone = builtin__array_clone_to_depth(&val, depth); builtin__vmemcpy(eptr, &val_clone, arr.element_size); eptr += arr.element_size; } } } return arr; } VV_LOC array builtin__new_array_from_c_array(int len, int cap, int elm_size, voidptr c_array) { builtin__panic_on_negative_len(len); builtin__panic_on_negative_cap(cap); int cap_ = cap; if (cap < len) { cap_ = len; } array _t1 = ((array){.data = builtin__alloc_array_data(((u64)(cap_)) * ((u64)(elm_size))),.offset = 0,.len = len,.cap = cap_,.flags = ArrayFlags__managed,.element_size = elm_size,}); array arr = _t1; builtin__vmemcpy(arr.data, c_array, ((u64)(len)) * ((u64)(elm_size))); return arr; } void builtin__array_ensure_cap(array* a, int required) { if (required <= a->cap) { return; } if (builtin__ArrayFlags_has(&a->flags, ArrayFlags__nogrow)) { builtin__panic_n(_S("array.ensure_cap: array with the flag `.nogrow` cannot grow in size, array required new size:"), required); VUNREACHABLE(); } i64 cap = (a->cap > 0 ? (((i64)(a->cap))) : (((i64)(2)))); for (;;) { if (!(required > cap)) break; cap *= 2; } if (cap > _const_max_int) { if (a->cap < _const_max_int) { cap = _const_max_int; } else { builtin__panic_n(_S("array.ensure_cap: array needs to grow to cap (which is > 2^31):"), cap); VUNREACHABLE(); } } u64 new_size = ((u64)(cap)) * ((u64)(a->element_size)); bool use_noscan_data = builtin__array_uses_noscan_data(*a); voidptr new_data = builtin__array_alloc_array_data_like_uninit(*a, new_size); if (a->data != ((void*)0)) { builtin__vmemcpy(new_data, a->data, ((u64)(a->len)) * ((u64)(a->element_size))); if (builtin__ArrayFlags_has(&a->flags, ArrayFlags__noslices) && !builtin__ArrayFlags_has(&a->flags, ArrayFlags__is_slice) && !builtin__array_buffer_has_slices(*a)) { { // Unsafe block if (builtin__ArrayFlags_has(&a->flags, ArrayFlags__managed)) { builtin___v_free(((u8*)(a->data)) - ((u64)(builtin__array_data_header_size()))); } else { builtin___v_free(a->data); } } } } a->data = new_data; a->offset = 0; a->cap = ((int)(cap)); { // Unsafe block if (use_noscan_data) { builtin__ArrayFlags_set(&a->flags, ArrayFlags__noscan_data); } else { builtin__ArrayFlags_clear(&a->flags, ArrayFlags__noscan_data); } } builtin__array_set_managed_flags(a, false); } array builtin__array_repeat(array a, int count) { return builtin__array_repeat_to_depth(a, count, 0); } array builtin__array_repeat_to_depth(array a, int count, int depth) { if (count < 0) { builtin__panic_n(_S("array.repeat: count is negative:"), count); VUNREACHABLE(); } u64 size = ((u64)(count)) * ((u64)(a.len)) * ((u64)(a.element_size)); if (size == 0) { size = ((u64)(a.element_size)); } bool use_noscan_data = depth == 0 && builtin__array_uses_noscan_data(a); voidptr data = ((void*)0); if (use_noscan_data) { data = builtin__array_alloc_array_data_like(a, size); } else { data = builtin__alloc_array_data(size); } array _t1 = ((array){.data = (voidptr)data,.offset = 0,.len = count * a.len,.cap = count * a.len,.flags = (use_noscan_data ? ((ArrayFlags__managed | ArrayFlags__noscan_data)) : (ArrayFlags__managed)),.element_size = a.element_size,}); array arr = _t1; if (a.len > 0) { u64 a_total_size = ((u64)(a.len)) * ((u64)(a.element_size)); u64 arr_step_size = ((u64)(a.len)) * ((u64)(arr.element_size)); u8* eptr = ((u8*)(arr.data)); { // Unsafe block if (eptr != ((void*)0)) { for (int _t2 = 0; _t2 < count; ++_t2) { if (depth > 0) { array ary_clone = builtin__array_clone_to_depth(&a, depth); builtin__vmemcpy(eptr, ary_clone.data, a_total_size); } else { builtin__vmemcpy(eptr, a.data, a_total_size); } eptr += arr_step_size; } } } } return arr; } inline VV_LOC bool builtin__array_needs_unique_shift(array a, int required) { return required <= a.cap && (builtin__ArrayFlags_has(&a.flags, ArrayFlags__is_slice) || builtin__array_buffer_has_slices(a)); } inline VV_LOC bool builtin__array_needs_unique_append(array a, int required) { return required <= a.cap && builtin__ArrayFlags_has(&a.flags, ArrayFlags__is_slice); } inline VV_LOC bool builtin__array_needs_unique_shrink(array a) { return builtin__ArrayFlags_has(&a.flags, ArrayFlags__is_slice) || builtin__array_buffer_has_slices(a); } void builtin__array_insert(array* a, int i, voidptr val) { if (i < 0 || i > a->len) { builtin__panic_n2(_S("array.insert: index out of range (i,a.len):"), i, a->len); VUNREACHABLE(); } if (a->len == _const_max_int) { builtin___v_panic(_S("array.insert: a.len reached max_int")); VUNREACHABLE(); } int required = a->len + 1; if (builtin__array_needs_unique_shift(*a, required)) { builtin__array_clone_shallow_to_cap(a, a->cap); } else if (required > a->cap) { builtin__array_ensure_cap(a, required); } { // Unsafe block builtin__vmemmove(builtin__array_get_unsafe(*a, i + 1), builtin__array_get_unsafe(*a, i), ((u64)((a->len - i))) * ((u64)(a->element_size))); builtin__array_set_unsafe(a, i, val); } a->len++; } void builtin__array_prepend(array* a, voidptr val) { builtin__array_insert(a, 0, val); } void builtin__array_delete(array* a, int i) { if (i < 0 || i >= a->len) { builtin__panic_n2(_S("array.delete: index out of range (i,a.len):"), i, a->len); VUNREACHABLE(); } if (i == a->len - 1 && !builtin__array_needs_unique_shrink(*a)) { a->len--; builtin__vmemset(((u8*)(a->data)) + ((u64)(a->len)) * ((u64)(a->element_size)), 0, ((u64)(a->element_size))); return; } builtin__array_delete_many(a, i, 1); } void builtin__array_delete_many(array* a, int i, int size) { if (i < 0 || ((i64)(i)) + ((i64)(size)) > ((i64)(a->len))) { if (size > 1) { builtin__panic_n3(_S("array.delete: index out of range (i,i+size,a.len):"), i, i + size, a->len); VUNREACHABLE(); } else { builtin__panic_n2(_S("array.delete: index out of range (i,a.len):"), i, a->len); VUNREACHABLE(); } } if (size == 0) { if (builtin__array_needs_unique_shrink(*a)) { builtin__array_clone_shallow_to_cap(a, a->len); } return; } if (!builtin__array_needs_unique_shrink(*a)) { int new_len = a->len - size; { // Unsafe block builtin__vmemmove(((u8*)(a->data)) + ((u64)(i)) * ((u64)(a->element_size)), ((u8*)(a->data)) + ((u64)(i + size)) * ((u64)(a->element_size)), ((u64)(a->len - i - size)) * ((u64)(a->element_size))); builtin__vmemset(((u8*)(a->data)) + ((u64)(new_len)) * ((u64)(a->element_size)), 0, ((u64)(size)) * ((u64)(a->element_size))); } a->len = new_len; return; } voidptr old_data = a->data; int new_size = a->len - size; if (new_size == 0) { builtin__ArrayFlags_clear(&a->flags, ((ArrayFlags__managed | ArrayFlags__noscan_data) | ArrayFlags__is_slice)); a->data = ((void*)0); a->offset = 0; a->len = 0; a->cap = 0; return; } int new_cap = new_size; bool use_noscan_data = builtin__array_uses_noscan_data(*a); a->data = builtin__array_alloc_array_data_like(*a, ((u64)(new_cap)) * ((u64)(a->element_size))); builtin__vmemcpy(a->data, old_data, ((u64)(i)) * ((u64)(a->element_size))); builtin__vmemcpy(((u8*)(a->data)) + ((u64)(i)) * ((u64)(a->element_size)), ((u8*)(old_data)) + ((u64)(i + size)) * ((u64)(a->element_size)), ((u64)(a->len - i - size)) * ((u64)(a->element_size))); if (builtin__ArrayFlags_has(&a->flags, ArrayFlags__noslices) && !builtin__ArrayFlags_has(&a->flags, ArrayFlags__managed)) { builtin___v_free(old_data); } a->len = new_size; a->cap = new_cap; a->offset = 0; { // Unsafe block if (use_noscan_data) { builtin__ArrayFlags_set(&a->flags, ArrayFlags__noscan_data); } else { builtin__ArrayFlags_clear(&a->flags, ArrayFlags__noscan_data); } } builtin__array_set_managed_flags(a, false); } void builtin__array_clear(array* a) { if (builtin__array_needs_unique_shrink(*a)) { builtin__ArrayFlags_clear(&a->flags, ((ArrayFlags__managed | ArrayFlags__noscan_data) | ArrayFlags__is_slice)); a->data = ((void*)0); a->offset = 0; a->cap = 0; } a->len = 0; } void builtin__array_reset(array* a) { builtin__vmemset(a->data, 0, a->len * a->element_size); } void builtin__array_trim(array* a, int index) { if (index < a->len) { if (index >= 0 && builtin__array_needs_unique_shrink(*a)) { builtin__array_delete_many(a, index, a->len - index); return; } a->len = index; } } void builtin__array_drop(array* a, int num) { if (num <= 0) { return; } int n = (num <= a->len ? (num) : (a->len)); u64 blen = ((u64)(n)) * ((u64)(a->element_size)); a->data = ((u8*)(a->data)) + blen; a->offset += ((int)(blen)); a->len -= n; a->cap -= n; } inline VV_LOC voidptr builtin__array_get_unsafe(array a, int i) { { // Unsafe block return ((u8*)(a.data)) + ((u64)(i)) * ((u64)(a.element_size)); } return 0; } VV_LOC voidptr builtin__array_get(array a, int i) { #if 1 { if (i < 0 || i >= a.len) { builtin__panic_n2(_S("array.get: index out of range (i,a.len):"), i, a.len); VUNREACHABLE(); } } #endif { // Unsafe block return ((u8*)(a.data)) + ((u64)(i)) * ((u64)(a.element_size)); } return 0; } VV_LOC voidptr builtin__array_get_i64(array a, i64 i) { #if 1 { if (i < 0 || i >= ((i64)(a.len))) { builtin__panic_n2(_S("array.get: index out of range (i,a.len):"), i, a.len); VUNREACHABLE(); } } #endif { // Unsafe block return ((u8*)(a.data)) + ((u64)(i)) * ((u64)(a.element_size)); } return 0; } VV_LOC voidptr builtin__array_get_u64(array a, u64 i) { #if 1 { if (i >= ((u64)(a.len))) { builtin___v_panic(builtin__string_plus_many(4, _MOV((string[4]){_S("array.get: index out of range (i,a.len): "), builtin__u64_str(i), _S(", "), builtin__impl_i64_to_string(a.len)}))); VUNREACHABLE(); } } #endif { // Unsafe block return ((u8*)(a.data)) + i * ((u64)(a.element_size)); } return 0; } VV_LOC voidptr builtin__array_get_ni(array a, int i) { return builtin__array_get(a, builtin__v_ni_index(i, a.len)); } VV_LOC voidptr builtin__array_get_with_check(array a, int i) { if (i < 0 || i >= a.len) { return 0; } { // Unsafe block return ((u8*)(a.data)) + ((u64)(i)) * ((u64)(a.element_size)); } return 0; } VV_LOC voidptr builtin__array_get_with_check_i64(array a, i64 i) { if (i < 0 || i >= ((i64)(a.len))) { return 0; } { // Unsafe block return ((u8*)(a.data)) + ((u64)(i)) * ((u64)(a.element_size)); } return 0; } VV_LOC voidptr builtin__array_get_with_check_u64(array a, u64 i) { if (i >= ((u64)(a.len))) { return 0; } { // Unsafe block return ((u8*)(a.data)) + i * ((u64)(a.element_size)); } return 0; } VV_LOC voidptr builtin__array_get_with_check_ni(array a, int i) { return builtin__array_get_with_check(a, builtin__v_ni_index(i, a.len)); } voidptr builtin__array_first(array a) { if (a.len == 0) { builtin___v_panic(_S("array.first: array is empty")); VUNREACHABLE(); } return a.data; } voidptr builtin__array_last(array a) { if (a.len == 0) { builtin___v_panic(_S("array.last: array is empty")); VUNREACHABLE(); } { // Unsafe block return ((u8*)(a.data)) + ((u64)(a.len - 1)) * ((u64)(a.element_size)); } return 0; } voidptr builtin__array_pop_left(array* a) { if (a->len == 0) { builtin___v_panic(_S("array.pop_left: array is empty")); VUNREACHABLE(); } voidptr first_elem = a->data; { // Unsafe block a->data = ((u8*)(a->data)) + ((u64)(a->element_size)); } a->offset += a->element_size; a->len--; a->cap--; return first_elem; } voidptr builtin__array_pop(array* a) { if (a->len == 0) { builtin___v_panic(_S("array.pop: array is empty")); VUNREACHABLE(); } int new_len = a->len - 1; u8* last_elem = ((u8*)(a->data)) + ((u64)(new_len)) * ((u64)(a->element_size)); if (builtin__array_needs_unique_shrink(*a)) { builtin__array_delete_many(a, new_len, 1); return last_elem; } a->len = new_len; return last_elem; } void builtin__array_delete_last(array* a) { if (a->len == 0) { builtin___v_panic(_S("array.delete_last: array is empty")); VUNREACHABLE(); } if (builtin__array_needs_unique_shrink(*a)) { builtin__array_delete_many(a, a->len - 1, 1); return; } a->len--; builtin__vmemset(((u8*)(a->data)) + ((u64)(a->len)) * ((u64)(a->element_size)), 0, ((u64)(a->element_size))); } VV_LOC array builtin__array_slice(array a, int start, int _end) { int end = (_end == _const_max_i64 || _end == _const_max_i32 ? (a.len) : (_end)); #if 1 { if (start > end) { builtin___v_panic(builtin__string_plus_many(4, _MOV((string[4]){_S("array.slice: invalid slice index (start>end):"), builtin__impl_i64_to_string(((i64)(start))), _S(", "), builtin__impl_i64_to_string(end)}))); VUNREACHABLE(); } if (end > a.len) { builtin___v_panic(builtin__string_plus_many(5, _MOV((string[5]){_S("array.slice: slice bounds out of range ("), builtin__impl_i64_to_string(end), _S(" >= "), builtin__impl_i64_to_string(a.len), _S(")")}))); VUNREACHABLE(); } if (start < 0) { builtin___v_panic(builtin__string__plus(_S("array.slice: slice bounds out of range (start<0):"), builtin__impl_i64_to_string(start))); VUNREACHABLE(); } } #endif builtin__array_mark_buffer_has_slices(&a); u64 offset = ((u64)(start)) * ((u64)(a.element_size)); u8* data = ((u8*)(a.data)) + offset; int l = end - start; ArrayFlags flags = ArrayFlags__is_slice; if (builtin__array_uses_noscan_data(a)) { builtin__ArrayFlags_set(&flags, ArrayFlags__noscan_data); } array res = ((array){ .data = (voidptr)data, .offset = a.offset + ((int)(offset)), .len = l, .cap = l, .flags = flags, .element_size = a.element_size, }); return res; } VV_LOC array builtin__array_slice_ni(array a, int _start, int _end) { builtin__array_mark_buffer_has_slices(&a); ArrayFlags flags = ArrayFlags__is_slice; if (builtin__array_uses_noscan_data(a)) { builtin__ArrayFlags_set(&flags, ArrayFlags__noscan_data); } int end = (_end == _const_max_i64 || _end == _const_max_i32 ? (a.len) : (_end)); int start = _start; if (start < 0) { start = a.len + start; if (start < 0) { start = 0; } } if (end < 0) { end = a.len + end; if (end < 0) { end = 0; } } if (end >= a.len) { end = a.len; } if (start >= a.len || start > end) { array res = ((array){ .data = a.data, .offset = 0, .len = 0, .cap = 0, .flags = flags, .element_size = a.element_size, }); return res; } u64 offset = ((u64)(start)) * ((u64)(a.element_size)); u8* data = ((u8*)(a.data)) + offset; int l = end - start; array res = ((array){ .data = (voidptr)data, .offset = a.offset + ((int)(offset)), .len = l, .cap = l, .flags = flags, .element_size = a.element_size, }); return res; } VV_LOC array builtin__array_clone_static_to_depth(array a, int depth) { return builtin__array_clone_to_depth(&a, depth); } array builtin__array_clone(array* a) { return builtin__array_clone_to_depth(a, 0); } array builtin__array_clone_to_depth(array* a, int depth) { u64 source_capacity_in_bytes = ((u64)(a->cap)) * ((u64)(a->element_size)); bool use_noscan_data = depth == 0 && builtin__array_uses_noscan_data(*a); voidptr data = ((void*)0); if (a->cap > 0) { if (use_noscan_data) { data = builtin__array_alloc_array_data_like(*a, source_capacity_in_bytes); } else { data = builtin__alloc_array_data(source_capacity_in_bytes); } } array _t1 = ((array){.data = (voidptr)data,.offset = 0,.len = a->len,.cap = a->cap,.flags = (use_noscan_data ? ((ArrayFlags__managed | ArrayFlags__noscan_data)) : (ArrayFlags__managed)),.element_size = a->element_size,}); array arr = _t1; if (depth > 0 && _us32_eq(sizeof(array),a->element_size) && a->len >= 0 && a->cap >= a->len) { array _t2 = ((array){.data = 0,.offset = 0,.len = 0,.cap = 0,.flags = 0,.element_size = 0,}); array ar = _t2; int asize = ((int)(sizeof(array))); for (int i = 0; i < a->len; ++i) { builtin__vmemcpy(&ar, builtin__array_get_unsafe(*a, i), asize); array ar_clone = builtin__array_clone_to_depth(&ar, depth - 1); builtin__array_set_unsafe(&arr, i, &ar_clone); } return arr; } else if (depth > 0 && _us32_eq(sizeof(string),a->element_size) && a->len >= 0 && a->cap >= a->len) { for (int i = 0; i < a->len; ++i) { string* str_ptr = ((string*)(builtin__array_get_unsafe(*a, i))); string str_clone = builtin__string_clone((*str_ptr)); builtin__array_set_unsafe(&arr, i, &str_clone); } return arr; } if (a->data != 0 && source_capacity_in_bytes > 0) { builtin__vmemcpy(arr.data, a->data, source_capacity_in_bytes); } return arr; } inline VV_LOC void builtin__array_set_unsafe(array* a, int i, voidptr val) { builtin__vmemcpy(((u8*)(a->data)) + ((u64)(a->element_size)) * ((u64)(i)), val, a->element_size); } VV_LOC void builtin__array_set(array* a, int i, voidptr val) { #if 1 { if (i < 0 || i >= a->len) { builtin__panic_n2(_S("array.set: index out of range (i,a.len):"), i, a->len); VUNREACHABLE(); } } #endif builtin__vmemcpy(((u8*)(a->data)) + ((u64)(a->element_size)) * ((u64)(i)), val, a->element_size); } VV_LOC void builtin__array_set_i64(array* a, i64 i, voidptr val) { #if 1 { if (i < 0 || i >= ((i64)(a->len))) { builtin__panic_n2(_S("array.set: index out of range (i,a.len):"), i, a->len); VUNREACHABLE(); } } #endif builtin__vmemcpy(((u8*)(a->data)) + ((u64)(a->element_size)) * ((u64)(i)), val, a->element_size); } VV_LOC void builtin__array_set_u64(array* a, u64 i, voidptr val) { #if 1 { if (i >= ((u64)(a->len))) { builtin___v_panic(builtin__string_plus_many(4, _MOV((string[4]){_S("array.set: index out of range (i,a.len): "), builtin__u64_str(i), _S(", "), builtin__impl_i64_to_string(a->len)}))); VUNREACHABLE(); } } #endif builtin__vmemcpy(((u8*)(a->data)) + ((u64)(a->element_size)) * i, val, a->element_size); } VV_LOC void builtin__array_set_ni(array* a, int i, voidptr val) { builtin__array_set(a, builtin__v_ni_index(i, a->len), val); } inline VV_LOC void builtin__copy_element_to(voidptr dest, voidptr src, int element_size) { { // Unsafe block switch (element_size) { case 1: { builtin__vmemcpy(dest, src, 1); break; } case 2: { builtin__vmemcpy(dest, src, 2); break; } case 4: { builtin__vmemcpy(dest, src, 4); break; } case 8: { builtin__vmemcpy(dest, src, 8); break; } case 16: { builtin__vmemcpy(dest, src, 16); break; } default: { { builtin__vmemcpy(dest, src, element_size); break; } } } } } VV_LOC void builtin__array_push(array* a, voidptr val) { #if 1 { if (a->len < 0) { builtin___v_panic(_S("array.push: negative len")); VUNREACHABLE(); } } #endif if (a->len >= _const_max_int) { builtin___v_panic(_S("array.push: len bigger than max_int")); VUNREACHABLE(); } int required = a->len + 1; if (required > a->cap) { builtin__array_ensure_cap(a, required); } else if (builtin__ArrayFlags_has(&a->flags, ArrayFlags__is_slice)) { builtin__array_clone_shallow_to_cap(a, a->cap); } builtin__copy_element_to(((u8*)(a->data)) + ((u64)(a->element_size)) * ((u64)(a->len)), val, a->element_size); a->len++; } void builtin__array_push_many(array* a, voidptr val, int size) { if (size <= 0 || val == ((void*)0)) { return; } i64 new_len = ((i64)(a->len)) + ((i64)(size)); if (new_len > _const_max_int) { builtin___v_panic(_S("array.push_many: new len exceeds max_int")); VUNREACHABLE(); } if (builtin__array_needs_unique_append(*a, ((int)(new_len)))) { builtin__array_clone_shallow_to_cap(a, a->cap); } bool is_self_append = a->data == val && a->data != 0; if (((int)(new_len)) > a->cap) { builtin__array_ensure_cap(a, ((int)(new_len))); } if (is_self_append) { array cloned = builtin__array_clone(a); builtin__vmemcpy(((u8*)(a->data)) + ((u64)(a->element_size)) * ((u64)(a->len)), cloned.data, ((u64)(a->element_size)) * ((u64)(size))); } else { if (a->data != 0 && val != 0) { builtin__vmemcpy(((u8*)(a->data)) + ((u64)(a->element_size)) * ((u64)(a->len)), val, ((u64)(a->element_size)) * ((u64)(size))); } } a->len = ((int)(new_len)); } void builtin__array_reverse_in_place(array* a) { if (a->len < 2 || a->element_size == 0) { return; } { // Unsafe block u8* tmp_value = builtin___v_malloc(a->element_size); for (int i = 0; i < VSAFE_DIV_int(a->len , 2); ++i) { builtin__vmemcpy(tmp_value, ((u8*)(a->data)) + ((u64)(i)) * ((u64)(a->element_size)), a->element_size); builtin__vmemcpy(((u8*)(a->data)) + ((u64)(i)) * ((u64)(a->element_size)), ((u8*)(a->data)) + ((u64)((int)(a->len - 1 - i))) * ((u64)(a->element_size)), a->element_size); builtin__vmemcpy(((u8*)(a->data)) + ((u64)((int)(a->len - 1 - i))) * ((u64)(a->element_size)), tmp_value, a->element_size); } builtin___v_free(tmp_value); } } array builtin__array_reverse(array a) { if (a.len < 2) { return a; } bool use_noscan_data = builtin__array_uses_noscan_data(a); array _t2 = ((array){.data = builtin__array_alloc_array_data_like(a, ((u64)(a.cap)) * ((u64)(a.element_size))),.offset = 0,.len = a.len,.cap = a.cap,.flags = (use_noscan_data ? ((ArrayFlags__managed | ArrayFlags__noscan_data)) : (ArrayFlags__managed)),.element_size = a.element_size,}); array arr = _t2; for (int i = 0; i < a.len; ++i) { builtin__array_set_unsafe(&arr, i, builtin__array_get_unsafe(a, (int)(a.len - 1 - i))); } return arr; } void builtin__array_free(array* a) { if (builtin__ArrayFlags_has(&a->flags, ArrayFlags__nofree)) { return; } u8* mblock_ptr = ((u8*)(((u64)(a->data)) - ((u64)(a->offset)))); if (mblock_ptr != ((void*)0)) { { // Unsafe block if (builtin__ArrayFlags_has(&a->flags, ArrayFlags__managed)) { builtin___v_free(mblock_ptr - builtin__array_data_header_size()); } else { builtin___v_free(mblock_ptr); } } } { // Unsafe block a->data = ((void*)0); a->offset = 0; a->len = 0; a->cap = 0; } } array builtin__array_filter(array a, bool (*predicate)(voidptr _d1)); bool builtin__array_any(array a, bool (*predicate)(voidptr _d1)); int builtin__array_count(array a, bool (*predicate)(voidptr _d1)); bool builtin__array_all(array a, bool (*predicate)(voidptr _d1)); array builtin__array_map(array a, voidptr (*callback)(voidptr _d1)); void builtin__array_sort(array* a, int (*callback)(voidptr _d1, voidptr _d2)); array builtin__array_sorted(array* a, int (*callback)(voidptr _d1, voidptr _d2)); void builtin__array_sort_with_compare(array* a, int (*callback)(const void* const_a, const void* const_b)) { #if 0 { } #else { builtin__vqsort(a->data, ((usize)(a->len)), ((usize)(a->element_size)), callback); } #endif } array builtin__array_sorted_with_compare(array* a, int (*callback)(const void* const_a, const void* const_b)) { array r = builtin__array_clone(a); builtin__vqsort(r.data, ((usize)(r.len)), ((usize)(r.element_size)), callback); return r; } bool builtin__array_contains(array a, voidptr value); int builtin__array_index(array a, voidptr value); int builtin__array_last_index(array a, voidptr value); void Array_string_free(Array_string* a) { for (int _t1 = 0; _t1 < a->len; ++_t1) { string* s = ((string*)a->data) + _t1; builtin__string_free(s); } array* arr = ((array*)(a)); builtin__array_free(arr); } string Array_string_str(Array_string a) { int sb_len = 4; if (a.len > 0) { sb_len += ((string*)a.data)[0].len; sb_len *= a.len; } sb_len += 2; strings__Builder sb = strings__new_builder(sb_len); strings__Builder_write_u8(&sb, '['); for (int i = 0; i < a.len; ++i) { string val = ((string*)a.data)[i]; strings__Builder_write_u8(&sb, '\''); strings__Builder_write_string(&sb, val); strings__Builder_write_u8(&sb, '\''); if (i < a.len - 1) { strings__Builder_write_string(&sb, _S(", ")); } } strings__Builder_write_u8(&sb, ']'); string res = strings__Builder_str(&sb); strings__Builder_free(&sb); return res; } string Array_u8_hex(Array_u8 b) { if (b.len == 0) { return _S(""); } return builtin__data_to_hex_string(b.data, b.len); } int builtin__copy(Array_u8* dst, Array_u8 src) { int min = (dst->len < src.len ? (dst->len) : (src.len)); if (min > 0) { builtin__vmemmove(dst->data, src.data, min); } return min; } void builtin__array_grow_cap(array* a, int amount) { i64 new_cap = ((i64)(amount)) + ((i64)(a->cap)); if (new_cap > _const_max_int) { builtin__panic_n(_S("array.grow_cap: max_int will be exceeded by new cap:"), new_cap); VUNREACHABLE(); } builtin__array_ensure_cap(a, ((int)(new_cap))); } void builtin__array_grow_len(array* a, int amount) { i64 new_len = ((i64)(amount)) + ((i64)(a->len)); if (new_len > _const_max_int) { builtin__panic_n(_S("array.grow_len: max_int will be exceeded by new len:"), new_len); VUNREACHABLE(); } builtin__array_ensure_cap(a, ((int)(new_len))); a->len = ((int)(new_len)); } Array_voidptr builtin__array_pointers(array a) { Array_voidptr res = builtin____new_array_with_default(0, 0, sizeof(voidptr), 0); for (int i = 0; i < a.len; ++i) { builtin__array_push((array*)&res, _MOV((voidptr[]){ builtin__array_get_unsafe(a, i) })); } return res; } Array_u8 builtin__voidptr_vbytes(voidptr data, int len) { array _t1 = ((array){.data = data,.offset = 0,.len = len,.cap = len,.flags = 0,.element_size = 1,}); array res = _t1; return res; } Array_u8 builtin__u8_vbytes(u8* data, int len) { return builtin__voidptr_vbytes(((voidptr)(data)), len); } void builtin__u8_free(u8* data) { builtin___v_free(data); } inline VV_LOC void builtin__panic_on_negative_len(int len) { if (len < 0) { builtin__panic_n(_S("negative .len:"), len); VUNREACHABLE(); } } inline VV_LOC void builtin__panic_on_negative_cap(int cap) { if (cap < 0) { builtin__panic_n(_S("negative .cap:"), cap); VUNREACHABLE(); } } VV_LOC array builtin____new_array_noscan(int mylen, int cap, int elm_size) { return builtin____new_array(mylen, cap, elm_size); } VV_LOC array builtin____new_array_with_default_noscan(int mylen, int cap, int elm_size, voidptr val) { return builtin____new_array_with_default(mylen, cap, elm_size, val); } VV_LOC array builtin____new_array_with_multi_default_noscan(int mylen, int cap, int elm_size, voidptr val) { return builtin____new_array_with_multi_default(mylen, cap, elm_size, val); } VV_LOC array builtin____new_array_with_array_default_noscan(int mylen, int cap, int elm_size, array val, int depth) { return builtin____new_array_with_array_default(mylen, cap, elm_size, val, depth); } VV_LOC void builtin__array_push_noscan(array* a, voidptr val) { builtin__array_push(a, val); } VV_LOC void builtin__array_push_many_noscan(array* a, voidptr val, int size) { builtin__array_push_many(a, val, size); } VV_LOC bool builtin__autostr_type_in_stack(int typ) { for (int i = 0; i < g_autostr_type_stack_len; i++) { if (g_autostr_type_stack[builtin__v_fixed_index(i, 64)] == typ) { return true; } } return false; } VV_LOC void builtin__autostr_type_push(int typ) { if (g_autostr_type_stack_len >= _const_autostr_type_stack_max_depth) { return; } g_autostr_type_stack[builtin__v_fixed_index(g_autostr_type_stack_len, 64)] = typ; g_autostr_type_stack_len++; } VV_LOC void builtin__autostr_type_pop(void) { if (g_autostr_type_stack_len > 0) { g_autostr_type_stack_len--; } } VV_LOC bool builtin__autostr_addr_in_stack(voidptr addr) { for (int i = 0; i < g_autostr_addr_stack_len; i++) { if (g_autostr_addr_stack[builtin__v_fixed_index(i, 64)] == addr) { return true; } } return false; } VV_LOC void builtin__autostr_addr_push(voidptr addr) { if (g_autostr_addr_stack_len >= _const_autostr_type_stack_max_depth) { return; } g_autostr_addr_stack[builtin__v_fixed_index(g_autostr_addr_stack_len, 64)] = addr; g_autostr_addr_stack_len++; } VV_LOC void builtin__autostr_addr_pop(void) { if (g_autostr_addr_stack_len > 0) { g_autostr_addr_stack_len--; } } VV_LOC string builtin__autostr_array_circular(int len) { if (len <= 0) { return _S("[]"); } strings__Builder sb = strings__new_builder(2 + len * 12); strings__Builder_write_string(&sb, _S("[")); for (int i = 0; i < len; ++i) { if (i > 0) { strings__Builder_write_string(&sb, _S(", ")); } strings__Builder_write_string(&sb, _S("")); } strings__Builder_write_string(&sb, _S("]")); string res = strings__Builder_str(&sb); strings__Builder_free(&sb); return res; } void builtin__print_backtrace(void) { } bool builtin__print_backtrace_skipping_top_frames(int xskipframes) { #if defined(CUSTOM_DEFINE_no_backtrace) { return false; } #else { } #endif return false; } VNORETURN void builtin___v_exit(int code) { exit(code); VUNREACHABLE(); for (;;) { } while(1); } _result_void builtin__at_exit(void (*cb)(void)) { #if 0 { } #else { i32 res = atexit(cb); if (res != 0) { return (_result_void){ .is_error=true, .err=builtin__error_with_code(_S("at_exit failed"), res), .data={E_STRUCT} }; } } #endif return (_result_void){0}; } VV_LOC void builtin__v_segmentation_fault_handler(i32 signal_number) { #if defined(CUSTOM_DEFINE_v2_native_windows_pe_minimal) { } #else { #if 0 { } #else { fprintf(stderr, "signal %d: segmentation fault\n", signal_number); } #endif #if defined(CUSTOM_DEFINE_use_libbacktrace) && !defined(__TINYC__) { } #elif 1 { builtin__print_backtrace_skipping_top_frames(1); } #else { } #endif builtin___v_exit(128 + signal_number); VUNREACHABLE(); } #endif } inline VV_LOC int builtin__v_fixed_index(int i, int len) { #if 1 { if (i < 0 || i >= len) { builtin___v_panic(builtin__string_plus_many(5, _MOV((string[5]){_S("fixed array index out of range (index: "), builtin__i64_str(((i64)(i))), _S(", len: "), builtin__i64_str(((i64)(len))), _S(")")}))); VUNREACHABLE(); } } #endif return i; } inline VV_LOC int builtin__v_fixed_index_i64(i64 i, int len) { #if 1 { if (i < 0 || i >= ((i64)(len))) { builtin___v_panic(builtin__string_plus_many(5, _MOV((string[5]){_S("fixed array index out of range (index: "), builtin__i64_str(i), _S(", len: "), builtin__i64_str(((i64)(len))), _S(")")}))); VUNREACHABLE(); } } #endif return ((int)(i)); } inline VV_LOC int builtin__v_fixed_index_u64(u64 i, int len) { #if 1 { if (i >= ((u64)(len))) { builtin___v_panic(builtin__string_plus_many(5, _MOV((string[5]){_S("fixed array index out of range (index: "), builtin__u64_str(i), _S(", len: "), builtin__i64_str(((i64)(len))), _S(")")}))); VUNREACHABLE(); } } #endif return ((int)(i)); } inline VV_LOC int builtin__v_fixed_index_ni(int i, int len) { return builtin__v_fixed_index(builtin__v_ni_index(i, len), len); } inline VV_LOC int builtin__v_slice_index_i64(i64 i) { if (i < ((i64)(_const_min_int)) || i > ((i64)(_const_max_int))) { builtin___v_panic(builtin__string__plus(_S("slice index out of range for int: "), builtin__i64_str(i))); VUNREACHABLE(); } return ((int)(i)); } inline VV_LOC int builtin__v_slice_index_u64(u64 i) { if (i > ((u64)(_const_max_int))) { builtin___v_panic(builtin__string__plus(_S("slice index out of range for int: "), builtin__u64_str(i))); VUNREACHABLE(); } return ((int)(i)); } Array_string builtin__arguments(void) { u8** argv = ((u8**)(g_main_argv)); Array_string res = builtin____new_array_with_default(0, g_main_argc, sizeof(string), 0); for (int i = 0; i < g_main_argc; ++i) { #if 0 { } #else { builtin__array_push((array*)&res, _MOV((string[]){ builtin__tos_clone(argv[i]) })); } #endif } return res; } string builtin__vcurrent_hash(void) { return _S("7647ce1"); } u64 builtin__v_getpid(void) { #if defined(CUSTOM_DEFINE_no_getpid) { } #elif 0 { } #else { return ((u64)(getpid())); } #endif return 0; } u64 builtin__v_gettid(void) { #if defined(CUSTOM_DEFINE_no_gettid) { } #elif 0 { } #elif 1 { return ((u64)(gettid())); } #elif 0 { } #else { } #endif return 0; } inline bool builtin__isnil(voidptr v) { return v == 0; } VV_LOC void builtin__builtin_init(void) { #if 1 { builtin__unbuffer_stdout(); } #endif } VNORETURN void builtin__panic_lasterr(string base) { builtin___v_panic(builtin__string__plus(base, _S(" unknown"))); VUNREACHABLE(); while(1); } void builtin__gc_check_leaks(void) { } bool builtin__gc_is_enabled(void) { return false; } void builtin__gc_enable(void) { } void builtin__gc_disable(void) { } void builtin__gc_collect(void) { } void builtin__gc_get_warn_proc(void) { } void builtin__gc_set_warn_proc(void (*cb)(char* msg, usize arg)) { } #if 0 #else #endif inline int builtin__vstrlen(u8* s) { return ((int)(strlen(((char*)(s))))); } inline int builtin__vstrlen_char(char* s) { return ((int)(strlen(s))); } inline voidptr builtin__vmemcpy(voidptr dest, const void* const_src, isize n) { if (n == 0 || ((u64)(dest)) <= 0xFFFF || ((u64)(const_src)) <= 0xFFFF) { return dest; } { // Unsafe block return memcpy(dest, const_src, n); } return 0; } inline voidptr builtin__vmemmove(voidptr dest, const void* const_src, isize n) { if (n == 0 || ((u64)(dest)) <= 0xFFFF || ((u64)(const_src)) <= 0xFFFF) { return dest; } { // Unsafe block return memmove(dest, const_src, n); } return 0; } inline int builtin__vmemcmp(const void* const_s1, const void* const_s2, isize n) { if (n == 0 || ((u64)(const_s1)) <= 0xFFFF || ((u64)(const_s2)) <= 0xFFFF) { return 0; } { // Unsafe block return memcmp(const_s1, const_s2, n); } return 0; } inline voidptr builtin__vmemset(voidptr s, int c, isize n) { if (n == 0 || ((u64)(s)) <= 0xFFFF) { return s; } { // Unsafe block return memset(s, c, n); } return 0; } inline VV_LOC voidptr builtin__vsort_ptr_at(voidptr base, usize index, usize size) { return ((voidptr)(((u8*)(base)) + index * size)); } VV_LOC void builtin__vstable_sort_merge(voidptr source, voidptr dest, usize left, usize mid, usize right, usize size, int (*sort_cb)(const void* const_a, const void* const_b)) { usize left_index = left; usize right_index = mid; usize dest_index = left; for (;;) { if (!(left_index < mid && right_index < right)) break; voidptr left_ptr = builtin__vsort_ptr_at(source, left_index, size); voidptr right_ptr = builtin__vsort_ptr_at(source, right_index, size); if (sort_cb(left_ptr, right_ptr) <= 0) { builtin__vmemcpy(builtin__vsort_ptr_at(dest, dest_index, size), left_ptr, ((isize)(size))); left_index++; } else { builtin__vmemcpy(builtin__vsort_ptr_at(dest, dest_index, size), right_ptr, ((isize)(size))); right_index++; } dest_index++; } if (left_index < mid) { builtin__vmemcpy(builtin__vsort_ptr_at(dest, dest_index, size), builtin__vsort_ptr_at(source, left_index, size), ((isize)((mid - left_index) * size))); } if (right_index < right) { builtin__vmemcpy(builtin__vsort_ptr_at(dest, dest_index, size), builtin__vsort_ptr_at(source, right_index, size), ((isize)((right - right_index) * size))); } } inline VV_LOC void builtin__vqsort(voidptr base, usize nmemb, usize size, int (*sort_cb)(const void* const_a, const void* const_b)) { if (nmemb < 2 || size == 0) { return; } isize total_size = ((isize)(nmemb * size)); u8* buffer = builtin___v_malloc(total_size); voidptr source = base; voidptr dest = ((voidptr)(buffer)); usize width = ((usize)(1)); for (;;) { if (!(width < nmemb)) break; usize left = ((usize)(0)); for (;;) { if (!(left < nmemb)) break; usize mid = (left + width < nmemb ? (left + width) : (nmemb)); usize right = (left + width + width < nmemb ? (left + width + width) : (nmemb)); builtin__vstable_sort_merge(source, dest, left, mid, right, size, sort_cb); left += width + width; } voidptr tmp = source; source = dest; dest = tmp; width += width; } if (source != base) { builtin__vmemcpy(base, source, total_size); } { // defer begin builtin___v_free(buffer); } // defer end } void builtin__chan_close(chan ch, Array_IError err) { } ChanState builtin__chan_try_pop(chan ch, voidptr obj) { return ChanState__success; } ChanState builtin__chan_try_push(chan ch, voidptr obj) { return ChanState__success; } VV_LOC void builtin___result_ok(voidptr data, _result* res, int size) { { // Unsafe block *res = ((_result){.is_error = 0,.err = _const_none__,}); builtin__vmemcpy(((u8*)(&res->err)) + sizeof(IError), data, size); } } VV_LOC void builtin___result_clone(_result* current, _result* res, int size) { { // Unsafe block *res = ((_result){.is_error = current->is_error,.err = current->err,}); builtin__vmemcpy(((u8*)(&res->err)) + sizeof(IError), ((u8*)(¤t->err)) + sizeof(IError), size); } } string builtin__IError_str(IError err) { if ((err)._typ == _IError_None___index) { return _S("none"); } int c = ((struct _IError_interface_methods*)(err._methods))->_method_code(err._object); if (c > 0) { return builtin__string_plus_many(3, _MOV((string[3]){((struct _IError_interface_methods*)(err._methods))->_method_msg(err._object), _S("; code: "), builtin__int_str(c)})); } return ((struct _IError_interface_methods*)(err._methods))->_method_msg(err._object); } string builtin__Error_msg(Error err) { return _S(""); } int builtin__Error_code(Error err) { return 0; } string builtin__MessageError_str(MessageError err) { if (err.code > 0) { return builtin__string_plus_many(3, _MOV((string[3]){err.msg, _S("; code: "), builtin__int_str(err.code)})); } return err.msg; } string builtin__MessageError_msg(MessageError err) { return err.msg; } int builtin__MessageError_code(MessageError err) { return err.code; } void builtin__MessageError_free(MessageError* err) { builtin__string_free(&err->msg); } inline IError builtin___v_error(string message) { ; return I_MessageError_to_Interface_IError((HEAP(MessageError, ((MessageError){.msg = message,.code = 0,})))); } inline IError builtin__error_with_code(string message, int code) { ; MessageError* _t2 = (MessageError*)builtin___v_malloc(sizeof(MessageError) == 0 ? 1 : sizeof(MessageError)); _t2->msg = message; _t2->code = code; return I_MessageError_to_Interface_IError( _t2); } VV_LOC void builtin___option_none(voidptr data, _option* option, int size) { { // Unsafe block *option = ((_option){.state = 2,.err = _const_none__,}); builtin__vmemcpy(((u8*)(&option->err)) + sizeof(IError), data, size); } } VV_LOC void builtin___option_ok(voidptr data, _option* option, int size) { { // Unsafe block *option = ((_option){.state = 0,.err = _const_none__,}); builtin__vmemcpy(((u8*)(&option->err)) + sizeof(IError), data, size); } } VV_LOC void builtin___option_clone(_option* current, _option* option, int size) { { // Unsafe block *option = ((_option){.state = current->state,.err = current->err,}); builtin__vmemcpy(((u8*)(&option->err)) + sizeof(IError), ((u8*)(¤t->err)) + sizeof(IError), size); } } VV_LOC void builtin___result_ok_markused(void) { _result _t1 = ((_result){.is_error = 0,.err = _const_none__,}); _result res = _t1; builtin___result_ok(((void*)0), (voidptr)&res, 0); } VV_LOC string builtin__None___str(None__ _d1) { return _S("none"); } string builtin__none_str(none _d1) { return _S("none"); } int builtin__input_character(void) { int ch = 0; #if 0 { } #elif 0 { } #else { ch = getchar(); if (ch == EOF) { return -1; } } #endif return ch; } int builtin__print_character(u8 ch) { #if 0 { } #elif 0 { } #elif 0 { } #else { i32 x = putchar(ch); if (x == EOF) { return -1; } } #endif return ch; } #if !defined(CUSTOM_DEFINE_nofloat) #endif inline string builtin__f64_str(f64 x) { { // Unsafe block strconv__Float64u _t1 = ((strconv__Float64u){.f = x,}); strconv__Float64u f = _t1; if (f.u == _const_strconv__double_minus_zero) { return _S("-0.0"); } if (f.u == _const_strconv__double_plus_zero) { return _S("0.0"); } } f64 abs_x = builtin__f64_abs(x); if (abs_x >= ((f64)(0.0001)) && abs_x < ((f64)(1.0e6))) { return strconv__f64_to_str_l(x); } else { return strconv__ftoa_64(x); } return (string){.str=(byteptr)"", .is_lit=1}; } inline string builtin__f64_strg(f64 x) { { // Unsafe block strconv__Float64u _t1 = ((strconv__Float64u){.f = x,}); strconv__Float64u f = _t1; if (f.u == _const_strconv__double_minus_zero || f.u == _const_strconv__double_plus_zero) { return _S("0.0"); } } f64 abs_x = builtin__f64_abs(x); if (abs_x >= ((f64)(0.0001)) && abs_x < ((f64)(1.0e6))) { return strconv__f64_to_str_l_with_dot(x); } else { return strconv__ftoa_64(x); } return (string){.str=(byteptr)"", .is_lit=1}; } inline string builtin__float_literal_str(float_literal d) { return builtin__f64_str(((f64)(d))); } inline string builtin__f64_strsci(f64 x, int digit_num) { int n_digit = digit_num; if (n_digit < 1) { n_digit = 1; } else if (n_digit > 17) { n_digit = 17; } return strconv__f64_to_str(x, n_digit); } inline string builtin__f64_strlong(f64 x) { return strconv__f64_to_str_l(x); } inline string builtin__f32_str(f32 x) { { // Unsafe block strconv__Float32u _t1 = ((strconv__Float32u){.f = x,}); strconv__Float32u f = _t1; if (f.u == _const_strconv__single_minus_zero) { return _S("-0.0"); } if (f.u == _const_strconv__single_plus_zero) { return _S("0.0"); } } f32 abs_x = builtin__f32_abs(x); if (abs_x >= ((f32)(0.0001)) && abs_x < ((f32)(1.0e6))) { return strconv__f32_to_str_l(x); } else { return strconv__ftoa_32(x); } return (string){.str=(byteptr)"", .is_lit=1}; } inline string builtin__f32_strg(f32 x) { { // Unsafe block strconv__Float32u _t1 = ((strconv__Float32u){.f = x,}); strconv__Float32u f = _t1; if (f.u == _const_strconv__single_minus_zero || f.u == _const_strconv__single_plus_zero) { return _S("0.0"); } } f32 abs_x = builtin__f32_abs(x); if (abs_x >= ((f32)(0.0001)) && abs_x < ((f32)(1.0e6))) { return strconv__f32_to_str_l_with_dot(x); } else { return strconv__ftoa_32(x); } return (string){.str=(byteptr)"", .is_lit=1}; } inline string builtin__f32_strsci(f32 x, int digit_num) { int n_digit = digit_num; if (n_digit < 1) { n_digit = 1; } else if (n_digit > 8) { n_digit = 8; } return strconv__f32_to_str(x, n_digit); } inline string builtin__f32_strlong(f32 x) { return strconv__f32_to_str_l(x); } inline f32 builtin__f32_abs(f32 a) { if (a < 0) { return -a; } return a; } inline f64 builtin__f64_abs(f64 a) { if (a < 0) { return -a; } return a; } inline f32 builtin__f32_min(f32 a, f32 b) { if (a < b) { return a; } return b; } inline f32 builtin__f32_max(f32 a, f32 b) { if (a > b) { return a; } return b; } inline f64 builtin__f64_min(f64 a, f64 b) { if (a < b) { return a; } return b; } inline f64 builtin__f64_max(f64 a, f64 b) { if (a > b) { return a; } return b; } inline bool builtin__f32_eq_epsilon(f32 a, f32 b) { f32 hi = builtin__f32_max(builtin__f32_abs(a), builtin__f32_abs(b)); f32 delta = builtin__f32_abs(a - b); if (hi > ((f32)(1.0))) { return delta <= hi * (4 * ((f32)(FLT_EPSILON))); } else { return (1 / (4 * ((f32)(FLT_EPSILON)))) * delta <= hi; } return 0; } inline bool builtin__f64_eq_epsilon(f64 a, f64 b) { f64 hi = builtin__f64_max(builtin__f64_abs(a), builtin__f64_abs(b)); f64 delta = builtin__f64_abs(a - b); if (hi > ((f64)(1.0))) { return delta <= hi * (4 * ((f64)(DBL_EPSILON))); } else { return (1 / (4 * ((f64)(DBL_EPSILON)))) * delta <= hi; } return 0; } inline VV_LOC u32 builtin__grapheme_hex_nibble(u8 c) { return (c <= '9' ? (((u32)((rune)(c - '0')))) : (((u32)((rune)(((c | 0x20)) - 'a') + 10)))); } inline VV_LOC u32 builtin__grapheme_hex_byte(string ranges, int i) { return ((v__lshift_u32(builtin__grapheme_hex_nibble(builtin__string_at(ranges, i)), (u64)4)) | builtin__grapheme_hex_nibble(builtin__string_at(ranges, i + 1))); } inline VV_LOC u32 builtin__grapheme_range_value(string ranges, int value_idx) { int i = value_idx * 8; u32 b0 = builtin__grapheme_hex_byte(ranges, i); u32 b1 = builtin__grapheme_hex_byte(ranges, i + 2); u32 b2 = builtin__grapheme_hex_byte(ranges, i + 4); u32 b3 = builtin__grapheme_hex_byte(ranges, i + 6); return (((b0 | (v__lshift_u32(b1, (u64)8))) | (v__lshift_u32(b2, (u64)16))) | (v__lshift_u32(b3, (u64)24))); } inline VV_LOC bool builtin__in_grapheme_ranges(rune r, string ranges) { u32 target = ((u32)(r)); int low = 0; int high = VSAFE_DIV_int(ranges.len , 16); for (;;) { if (!(low < high)) break; int mid = low + VSAFE_DIV_int((high - low) , 2); u32 lo = builtin__grapheme_range_value(ranges, mid * 2); u32 hi = builtin__grapheme_range_value(ranges, mid * 2 + 1); if (target < lo) { high = mid; } else if (target > hi) { low = mid + 1; } else { return true; } } return false; } inline VV_LOC GraphemeBreakProperty builtin__grapheme_break_property(rune r) { if (r == '\r') { return GraphemeBreakProperty__cr; } if (r == '\n') { return GraphemeBreakProperty__lf; } if (r == 0x200d) { return GraphemeBreakProperty__zwj; } if (r >= 0x1f1e6 && r <= 0x1f1ff) { return GraphemeBreakProperty__regional_indicator; } if (r >= 0xac00 && r <= 0xd7a3) { return (VSAFE_MOD_u32((((u32)(r)) - 0xac00) , 28) == 0 ? (GraphemeBreakProperty__lv) : (GraphemeBreakProperty__lvt)); } if ((r >= 0x1100 && r <= 0x115f) || (r >= 0xa960 && r <= 0xa97c)) { return GraphemeBreakProperty__l; } if ((r >= 0x1160 && r <= 0x11a7) || (r >= 0xd7b0 && r <= 0xd7c6)) { return GraphemeBreakProperty__v; } if ((r >= 0x11a8 && r <= 0x11ff) || (r >= 0xd7cb && r <= 0xd7fb)) { return GraphemeBreakProperty__t; } if (builtin__in_grapheme_ranges(r, _const_grapheme_control_ranges)) { return GraphemeBreakProperty__control; } if (builtin__in_grapheme_ranges(r, _const_grapheme_extend_ranges)) { return GraphemeBreakProperty__extend; } if (builtin__in_grapheme_ranges(r, _const_grapheme_spacing_mark_ranges)) { return GraphemeBreakProperty__spacing_mark; } if (builtin__in_grapheme_ranges(r, _const_grapheme_prepend_ranges)) { return GraphemeBreakProperty__prepend; } return GraphemeBreakProperty__other; } inline VV_LOC bool builtin__is_extended_pictographic(rune r) { return builtin__in_grapheme_ranges(r, _const_grapheme_extended_pictographic_ranges); } inline VV_LOC GraphemeState builtin__grapheme_state_from_rune(rune r, GraphemeBreakProperty prop) { return ((GraphemeState){.prev_prop = prop,.ri_count = (prop == GraphemeBreakProperty__regional_indicator ? (1) : (0)),.extended_pictographic_state = (builtin__is_extended_pictographic(r) ? (((u8)(1))) : (((u8)(0)))),}); } inline VV_LOC void builtin__GraphemeState_push(GraphemeState* gs, rune r, GraphemeBreakProperty prop) { gs->prev_prop = prop; gs->ri_count = (prop == GraphemeBreakProperty__regional_indicator ? (gs->ri_count + 1) : (0)); if (builtin__is_extended_pictographic(r)) { gs->extended_pictographic_state = 1; } else if (prop == GraphemeBreakProperty__extend && gs->extended_pictographic_state == 1) { } else if (prop == GraphemeBreakProperty__zwj && gs->extended_pictographic_state == 1) { gs->extended_pictographic_state = 2; } else { gs->extended_pictographic_state = 0; } } inline VV_LOC bool builtin__should_break_grapheme(GraphemeState gs, rune r, GraphemeBreakProperty prop) { switch (gs.prev_prop) { case GraphemeBreakProperty__cr: { if (prop == GraphemeBreakProperty__lf) { return false; } return true; } case GraphemeBreakProperty__lf: case GraphemeBreakProperty__control: { return true; } case GraphemeBreakProperty__l: { if (prop == GraphemeBreakProperty__l || prop == GraphemeBreakProperty__v || prop == GraphemeBreakProperty__lv || prop == GraphemeBreakProperty__lvt) { return false; } break; } case GraphemeBreakProperty__lv: case GraphemeBreakProperty__v: { if (prop == GraphemeBreakProperty__v || prop == GraphemeBreakProperty__t) { return false; } break; } case GraphemeBreakProperty__lvt: case GraphemeBreakProperty__t: { if (prop == GraphemeBreakProperty__t) { return false; } break; } case GraphemeBreakProperty__prepend: { return false; } case GraphemeBreakProperty__regional_indicator: { if (prop == GraphemeBreakProperty__regional_indicator && VSAFE_MOD_int(gs.ri_count , 2) == 1) { return false; } break; } case GraphemeBreakProperty__other: case GraphemeBreakProperty__extend: case GraphemeBreakProperty__spacing_mark: case GraphemeBreakProperty__zwj: default: { { break; } } } if (prop == GraphemeBreakProperty__cr || prop == GraphemeBreakProperty__lf || prop == GraphemeBreakProperty__control) { return true; } if (prop == GraphemeBreakProperty__extend || prop == GraphemeBreakProperty__zwj || prop == GraphemeBreakProperty__spacing_mark) { return false; } if (gs.extended_pictographic_state == 2 && builtin__is_extended_pictographic(r)) { return false; } return true; } inline VV_LOC int builtin__utf8_rune_visible_width(rune r, GraphemeBreakProperty prop) { if (prop == GraphemeBreakProperty__extend || prop == GraphemeBreakProperty__zwj || prop == GraphemeBreakProperty__spacing_mark || prop == GraphemeBreakProperty__prepend) { return 0; } if (r >= 0x1100 && (r <= 0x115f || r == 0x2329 || r == 0x232a || (r >= 0x2e80 && r <= 0xa4cf && r != 0x303f) || (r >= 0xac00 && r <= 0xd7a3) || (r >= 0xf900 && r <= 0xfaff) || (r >= 0xfe10 && r <= 0xfe19) || (r >= 0xfe30 && r <= 0xfe6f) || (r >= 0xff00 && r <= 0xff60) || (r >= 0xffe0 && r <= 0xffe6) || (r >= 0x1f300 && r <= 0x1f64f) || (r >= 0x1f680 && r <= 0x1f6ff) || (r >= 0x1f900 && r <= 0x1f9ff) || (r >= 0x1fa70 && r <= 0x1faff) || (r >= 0x20000 && r <= 0x3fffd))) { return 2; } return 1; } VV_LOC Array_string builtin__string_graphemes_impl(string s) { Array_rune runes = builtin__string_runes(s); if (runes.len == 0) { return builtin____new_array_with_default(0, 0, sizeof(string), 0); } Array_string res = builtin____new_array_with_default(0, runes.len, sizeof(string), 0); Array_rune cluster = builtin____new_array_with_default(0, 4, sizeof(rune), 0); GraphemeBreakProperty first_prop = builtin__grapheme_break_property((*(rune*)builtin__array_get(runes, 0))); GraphemeState state = builtin__grapheme_state_from_rune((*(rune*)builtin__array_get(runes, 0)), first_prop); builtin__array_push((array*)&cluster, _MOV((rune[]){ (*(rune*)builtin__array_get(runes, 0)) })); Array_rune _t3 = builtin__array_slice(runes, 1, 2147483647); for (int _t4 = 0; _t4 < _t3.len; ++_t4) { rune r = ((rune*)_t3.data)[_t4]; GraphemeBreakProperty prop = builtin__grapheme_break_property(r); if (builtin__should_break_grapheme(state, r, prop)) { builtin__array_push((array*)&res, _MOV((string[]){ Array_rune_string(cluster) })); cluster = builtin____new_array_with_default(0, 4, sizeof(rune), 0); builtin__array_push((array*)&cluster, _MOV((rune[]){ r })); state = builtin__grapheme_state_from_rune(r, prop); continue; } builtin__array_push((array*)&cluster, _MOV((rune[]){ r })); builtin__GraphemeState_push(&state, r, prop); } builtin__array_push((array*)&res, _MOV((string[]){ Array_rune_string(cluster) })); return res; } inline VV_LOC int builtin__utf8_grapheme_visible_length(string s) { Array_rune runes = builtin__string_runes(s); if (runes.len == 0) { return 0; } GraphemeBreakProperty first_prop = builtin__grapheme_break_property((*(rune*)builtin__array_get(runes, 0))); GraphemeState state = builtin__grapheme_state_from_rune((*(rune*)builtin__array_get(runes, 0)), first_prop); int total = 0; int cluster_width = builtin__utf8_rune_visible_width((*(rune*)builtin__array_get(runes, 0)), first_prop); Array_rune _t2 = builtin__array_slice(runes, 1, 2147483647); for (int _t3 = 0; _t3 < _t2.len; ++_t3) { rune r = ((rune*)_t2.data)[_t3]; GraphemeBreakProperty prop = builtin__grapheme_break_property(r); if (builtin__should_break_grapheme(state, r, prop)) { total += cluster_width; cluster_width = builtin__utf8_rune_visible_width(r, prop); state = builtin__grapheme_state_from_rune(r, prop); continue; } int rune_width = builtin__utf8_rune_visible_width(r, prop); if (rune_width > cluster_width) { cluster_width = rune_width; } builtin__GraphemeState_push(&state, r, prop); } return total + cluster_width; } _option_rune builtin__input_rune(void) { int x = builtin__input_character(); if (x <= 0) { return (_option_rune){ .state=2, .err=_const_none__, .data={E_STRUCT} }; } int char_len = builtin__utf8_char_len(((u8)(x))); if (char_len == 1) { _option_rune _t2; builtin___option_ok(&(rune[]) { x }, (_option*)(&_t2), sizeof(rune)); return _t2; } u8 b = ((u8)(x)); b = v__lshift_u8(b, (u64)char_len); rune res = ((rune)(b)); int shift = 6 - char_len; for (int i = 1; i < char_len; i++) { rune c = ((rune)(builtin__input_character())); res = v__lshift_rune(((rune)(res)), (u64)shift); res |= (c & 63); shift = 6; } _option_rune _t3; builtin___option_ok(&(rune[]) { res }, (_option*)(&_t3), sizeof(rune)); return _t3; } _option_rune builtin__InputRuneIterator_next(InputRuneIterator* self) { return builtin__input_rune(); } InputRuneIterator builtin__input_rune_iterator(void) { return ((InputRuneIterator){E_STRUCT}); } string builtin__ptr_str(voidptr ptr) { string buf1 = builtin__u64_to_hex_no_leading_zeros(((u64)(ptr)), 16); return buf1; } string builtin__isize_str(isize x) { return builtin__i64_str(((i64)(x))); } string builtin__usize_str(usize x) { return builtin__u64_str(((u64)(x))); } string builtin__char_str(char* cptr) { return builtin__u64_hex(((u64)(cptr))); } inline VV_LOC string builtin__int_str_l(int nn, int max) { { // Unsafe block i64 n = ((i64)(nn)); int d = 0; if (n == 0) { return _S("0"); } #if 0 { } #else { if (n == _const_min_i32) { return _S("-2147483648"); } } #endif bool is_neg = false; if (n < 0) { n = -n; is_neg = true; } int index = max; u8* buf = builtin__malloc_noscan(max + 1); buf[index] = 0; index--; for (;;) { if (!(n > 0)) break; int n1 = ((int)(VSAFE_DIV_i64(n , 100))); d = ((int)(v__lshift_u32(((u32)(((int)(n)) - (n1 * 100))), (u64)1))); n = n1; buf[index] = _const_digit_pairs.str[d]; index--; d++; buf[index] = _const_digit_pairs.str[d]; index--; } index++; if (d < 20) { index++; } if (is_neg) { index--; buf[index] = '-'; } int diff = max - index; builtin__vmemmove(buf, ((voidptr)(buf + index)), diff + 1); return builtin__tos(buf, diff); } return (string){.str=(byteptr)"", .is_lit=1}; } string builtin__i8_str(i8 n) { return builtin__int_str_l(((int)(n)), 4); } string builtin__i16_str(i16 n) { return builtin__int_str_l(((int)(n)), 6); } string builtin__u16_str(u16 n) { return builtin__int_str_l(((int)(n)), 6); } string builtin__i32_str(i32 n) { return builtin__int_str_l(((int)(n)), 11); } string builtin__int_hex_full(int nn) { return builtin__u64_to_hex(((u64)(nn)), 8); } string builtin__int_str(int n) { #if defined(CUSTOM_DEFINE_new_int) { } #else { return builtin__int_str_l(n, 11); } #endif return (string){.str=(byteptr)"", .is_lit=1}; } inline string builtin__u32_str(u32 nn) { { // Unsafe block u32 n = nn; u32 d = ((u32)(0)); if (n == 0) { return _S("0"); } int max = 10; u8* buf = builtin__malloc_noscan(max + 1); int index = max; buf[index] = 0; index--; for (;;) { if (!(n > 0)) break; u32 n1 = VSAFE_DIV_u32(n , ((u32)(100))); d = (v__lshift_u32((n - (n1 * ((u32)(100)))), (u64)((u32)(1)))); n = n1; buf[index] = _const_digit_pairs.str[ ((int)(d))]; index--; d++; buf[index] = _const_digit_pairs.str[ ((int)(d))]; index--; } index++; if (d < ((u32)(20))) { index++; } int diff = max - index; builtin__vmemmove(buf, ((voidptr)(buf + index)), diff + 1); return builtin__tos(buf, diff); } return (string){.str=(byteptr)"", .is_lit=1}; } inline string builtin__int_literal_str(int_literal n) { return builtin__impl_i64_to_string(n); } inline string builtin__i64_str(i64 nn) { return builtin__impl_i64_to_string(nn); } VV_LOC string builtin__impl_i64_to_string(i64 nn) { { // Unsafe block i64 n = nn; i64 d = ((i64)(0)); if (n == 0) { return _S("0"); } else if (n == _const_min_i64) { return _S("-9223372036854775808"); } int max = 20; u8* buf = builtin__malloc_noscan(max + 1); bool is_neg = false; if (n < 0) { n = -n; is_neg = true; } int index = max; buf[index] = 0; index--; for (;;) { if (!(n > 0)) break; i64 n1 = VSAFE_DIV_i64(n , ((i64)(100))); d = (v__lshift_u32(((u32)(n - (n1 * ((i64)(100))))), (u64)((i64)(1)))); n = n1; buf[index] = _const_digit_pairs.str[ ((int)(d))]; index--; d++; buf[index] = _const_digit_pairs.str[ ((int)(d))]; index--; } index++; if (d < ((i64)(20))) { index++; } if (is_neg) { index--; buf[index] = '-'; } int diff = max - index; builtin__vmemmove(buf, ((voidptr)(buf + index)), diff + 1); return builtin__tos(buf, diff); } return (string){.str=(byteptr)"", .is_lit=1}; } inline string builtin__u64_str(u64 nn) { { // Unsafe block u64 n = nn; u64 d = ((u64)(0)); if (n == 0) { return _S("0"); } int max = 20; u8* buf = builtin__malloc_noscan(max + 1); int index = max; buf[index] = 0; index--; for (;;) { if (!(n > 0)) break; u64 n1 = VSAFE_DIV_u64(n , 100); d = (v__lshift_u64((n - (n1 * 100)), (u64)1)); n = n1; buf[index] = _const_digit_pairs.str[ ((int)(d))]; index--; d++; buf[index] = _const_digit_pairs.str[ ((int)(d))]; index--; } index++; if (d < 20) { index++; } int diff = max - index; builtin__vmemmove(buf, ((voidptr)(buf + index)), diff + 1); return builtin__tos(buf, diff); } return (string){.str=(byteptr)"", .is_lit=1}; } string builtin__bool_str(bool b) { if (b) { return _S("true"); } return _S("false"); } inline VV_LOC string builtin__u64_to_hex(u64 nn, u8 len) { u64 n = nn; Array_fixed_u8_17 buf = {0}; buf[len] = 0; int i = 0; for (i = (len - 1); i >= 0; i--) { u8 d = ((u8)((n & 0xF))); buf[i] = (d < 10 ? ((rune)(d + '0')) : ((u8)(d + 87))); n = v__rshift_u64(n, (u64)4); } return builtin__tos(builtin__memdup(&buf[0], (len + 1)), len); } inline VV_LOC string builtin__u64_to_hex_no_leading_zeros(u64 nn, u8 len) { u64 n = nn; Array_fixed_u8_17 buf = {0}; buf[len] = 0; int i = 0; for (i = (len - 1); i >= 0; i--) { u8 d = ((u8)((n & 0xF))); buf[i] = (d < 10 ? ((rune)(d + '0')) : ((u8)(d + 87))); n = v__rshift_u64(n, (u64)4); if (n == 0) { break; } } int res_len = (int)(len - i); return builtin__tos(builtin__memdup(&buf[i], res_len + 1), res_len); } string builtin__u8_hex(u8 nn) { if (nn == 0) { return _S("00"); } return builtin__u64_to_hex(nn, 2); } string builtin__char_hex(char c) { return builtin__u8_hex(((u8)(c))); } string builtin__rune_hex(rune r) { return builtin__u32_hex(((u32)(r))); } string builtin__i8_hex(i8 nn) { if (nn == 0) { return _S("00"); } return builtin__u64_to_hex(((u64)(nn)), 2); } string builtin__u16_hex(u16 nn) { if (nn == 0) { return _S("0"); } return builtin__u64_to_hex_no_leading_zeros(nn, 4); } string builtin__i16_hex(i16 nn) { return builtin__u16_hex(((u16)(nn))); } string builtin__u32_hex(u32 nn) { if (nn == 0) { return _S("0"); } return builtin__u64_to_hex_no_leading_zeros(nn, 8); } string builtin__int_hex(int nn) { return builtin__u32_hex(((u32)(nn))); } string builtin__int_hex2(int n) { return builtin__string__plus(_S("0x"), builtin__int_hex(n)); } string builtin__u64_hex(u64 nn) { if (nn == 0) { return _S("0"); } return builtin__u64_to_hex_no_leading_zeros(nn, 16); } string builtin__i64_hex(i64 nn) { return builtin__u64_hex(((u64)(nn))); } string builtin__int_literal_hex(int_literal nn) { return builtin__u64_hex(((u64)(nn))); } string builtin__voidptr_str(voidptr nn) { return builtin__string__plus(_S("0x"), builtin__u64_hex(((u64)(nn)))); } string builtin__byteptr_str(byteptr nn) { return builtin__string__plus(_S("0x"), builtin__u64_hex(((u64)(nn)))); } string builtin__charptr_str(charptr nn) { return builtin__string__plus(_S("0x"), builtin__u64_hex(((u64)(nn)))); } string builtin__u8_hex_full(u8 nn) { return builtin__u64_to_hex(((u64)(nn)), 2); } string builtin__i8_hex_full(i8 nn) { return builtin__u64_to_hex(((u64)(nn)), 2); } string builtin__u16_hex_full(u16 nn) { return builtin__u64_to_hex(((u64)(nn)), 4); } string builtin__i16_hex_full(i16 nn) { return builtin__u64_to_hex(((u64)(nn)), 4); } string builtin__u32_hex_full(u32 nn) { return builtin__u64_to_hex(((u64)(nn)), 8); } string builtin__i64_hex_full(i64 nn) { return builtin__u64_to_hex(((u64)(nn)), 16); } string builtin__voidptr_hex_full(voidptr nn) { return builtin__u64_to_hex(((u64)(nn)), 16); } string builtin__int_literal_hex_full(int_literal nn) { return builtin__u64_to_hex(((u64)(nn)), 16); } string builtin__u64_hex_full(u64 nn) { return builtin__u64_to_hex(nn, 16); } string builtin__u8_str(u8 b) { return builtin__int_str_l(((int)(b)), 4); } string builtin__u8_ascii_str(u8 b) { string _t1 = ((string){.str = builtin__malloc_noscan(2), .len = 1}); string str = _t1; { // Unsafe block str.str[0] = b; str.str[1] = 0; } return str; } string builtin__u8_str_escaped(u8 b) { string _t1 = (string){.str=(byteptr)"", .is_lit=1}; if (b == (0)) { _t1 = _S("`\\0`"); } else if (b == (7)) { _t1 = _S("`\\a`"); } else if (b == (8)) { _t1 = _S("`\\b`"); } else if (b == (9)) { _t1 = _S("`\\t`"); } else if (b == (10)) { _t1 = _S("`\\n`"); } else if (b == (11)) { _t1 = _S("`\\v`"); } else if (b == (12)) { _t1 = _S("`\\f`"); } else if (b == (13)) { _t1 = _S("`\\r`"); } else if (b == (27)) { _t1 = _S("`\\e`"); } else if ((b >= 32 && b <= 126)) { _t1 = builtin__u8_ascii_str(b); } else { string xx = builtin__u8_hex(b); string yy = builtin__string__plus(_S("0x"), xx); builtin__string_free(&xx); _t1 = yy; }string str = _t1; return str; } inline bool builtin__u8_is_capital(u8 c) { return c >= 'A' && c <= 'Z'; } string Array_u8_bytestr(Array_u8 b) { { // Unsafe block u8* buf = builtin__malloc_noscan(b.len + 1); builtin__vmemcpy(buf, b.data, b.len); buf[b.len] = 0; return builtin__tos(buf, b.len); } return (string){.str=(byteptr)"", .is_lit=1}; } _result_rune Array_u8_byterune(Array_u8 b) { _result_rune _t1 = Array_u8_utf8_to_utf32(b); if (_t1.is_error) { _result_rune _t2 = {0}; _t2.is_error = true; _t2.err = _t1.err; return _t2; } rune r = (*(rune*)_t1.data); _result_rune _t3; builtin___result_ok(&(rune[]) { ((rune)(r)) }, (_result*)(&_t3), sizeof(rune)); return _t3; } string builtin__u8_repeat(u8 b, int count) { if (count <= 0) { return _S(""); } else if (count == 1) { return builtin__u8_ascii_str(b); } u8* bytes = builtin__malloc_noscan(count + 1); { // Unsafe block builtin__vmemset(bytes, b, count); bytes[count] = 0; } return builtin__u8_vstring_with_len(bytes, count); } inline int builtin__int_min(int a, int b) { return (a < b ? (a) : (b)); } inline int builtin__int_max(int a, int b) { return (a > b ? (a) : (b)); } inline VV_LOC bool builtin__fast_string_eq(string a, string b) { if (a.len != b.len) { return false; } { // Unsafe block return memcmp(a.str, b.str, b.len) == 0; } return 0; } VV_LOC u64 builtin__map_hash_string(voidptr pkey) { string key = *((string*)(pkey)); return wyhash(key.str, ((u64)(key.len)), 0, ((u64*)(((voidptr)(_wyp))))); } VV_LOC u64 builtin__map_hash_int_1(voidptr pkey) { return wyhash64(*((u8*)(pkey)), 0); } VV_LOC u64 builtin__map_hash_int_2(voidptr pkey) { return wyhash64(*((u16*)(pkey)), 0); } VV_LOC u64 builtin__map_hash_int_4(voidptr pkey) { return wyhash64(*((u32*)(pkey)), 0); } VV_LOC u64 builtin__map_hash_int_8(voidptr pkey) { return wyhash64(*((u64*)(pkey)), 0); } VV_LOC voidptr builtin__map_enum_fn(int kind, int esize) { if (!(kind == 1 || kind == 2 || kind == 3)) { builtin___v_panic(_S("map_enum_fn: invalid kind")); VUNREACHABLE(); } if (esize > 8 || esize < 0) { builtin___v_panic(_S("map_enum_fn: invalid esize")); VUNREACHABLE(); } if (kind == 1) { if (esize > 4) { return ((voidptr)(builtin__map_hash_int_8)); } if (esize > 2) { return ((voidptr)(builtin__map_hash_int_4)); } if (esize > 1) { return ((voidptr)(builtin__map_hash_int_2)); } if (esize > 0) { return ((voidptr)(builtin__map_hash_int_1)); } } if (kind == 2) { if (esize > 4) { return ((voidptr)(builtin__map_eq_int_8)); } if (esize > 2) { return ((voidptr)(builtin__map_eq_int_4)); } if (esize > 1) { return ((voidptr)(builtin__map_eq_int_2)); } if (esize > 0) { return ((voidptr)(builtin__map_eq_int_1)); } } if (kind == 3) { if (esize > 4) { return ((voidptr)(builtin__map_clone_int_8)); } if (esize > 2) { return ((voidptr)(builtin__map_clone_int_4)); } if (esize > 1) { return ((voidptr)(builtin__map_clone_int_2)); } if (esize > 0) { return ((voidptr)(builtin__map_clone_int_1)); } } return ((void*)0); } VV_LOC void builtin__DenseArray_zeros_to_end(DenseArray* d) { u8* tmp_value = builtin___v_malloc(d->value_bytes); u8* tmp_key = builtin___v_malloc(d->key_bytes); int count = 0; for (int i = 0; i < d->len; ++i) { if (builtin__DenseArray_has_index(d, i)) { { // Unsafe block if (count != i) { memcpy(tmp_key, builtin__DenseArray_key(d, count), d->key_bytes); memcpy(builtin__DenseArray_key(d, count), builtin__DenseArray_key(d, i), d->key_bytes); memcpy(builtin__DenseArray_key(d, i), tmp_key, d->key_bytes); memcpy(tmp_value, builtin__DenseArray_value(d, count), d->value_bytes); memcpy(builtin__DenseArray_value(d, count), builtin__DenseArray_value(d, i), d->value_bytes); memcpy(builtin__DenseArray_value(d, i), tmp_value, d->value_bytes); } } count++; } } { // Unsafe block builtin___v_free(tmp_value); builtin___v_free(tmp_key); d->deletes = 0; builtin___v_free(d->all_deleted); d->all_deleted = ((void*)0); } d->len = count; int old_cap = d->cap; if (count < 8) { d->cap = 8; } else { d->cap = count; } { // Unsafe block d->values = builtin__realloc_data(d->values, d->value_bytes * old_cap, d->value_bytes * d->cap); d->keys = builtin__realloc_data(d->keys, d->key_bytes * old_cap, d->key_bytes * d->cap); } } inline VV_LOC DenseArray builtin__new_dense_array(int key_bytes, int value_bytes) { int cap = 8; return ((DenseArray){ .key_bytes = key_bytes, .value_bytes = value_bytes, .cap = cap, .len = 0, .deletes = 0, .all_deleted = ((void*)0), .keys = builtin___v_malloc(builtin____at_least_one(((u64)(cap)) * ((u64)(key_bytes)))), .values = builtin___v_malloc(builtin____at_least_one(((u64)(cap)) * ((u64)(value_bytes)))), }); } inline VV_LOC voidptr builtin__DenseArray_key(DenseArray* d, int i) { return ((voidptr)(d->keys + i * d->key_bytes)); } inline VV_LOC voidptr builtin__DenseArray_value(DenseArray* d, int i) { return ((voidptr)(d->values + i * d->value_bytes)); } inline VV_LOC bool builtin__DenseArray_has_index(DenseArray* d, int i) { return d->deletes == 0 || d->all_deleted[i] == 0; } inline VV_LOC void builtin__DenseArray_trim_deleted_tail(DenseArray* d) { if (d->deletes == 0) { return; } for (;;) { if (!(d->len > 0 && d->all_deleted[d->len - 1] != 0)) break; { // Unsafe block d->all_deleted[d->len - 1] = 0; } d->deletes--; d->len--; } if (d->deletes == 0) { { // Unsafe block builtin___v_free(d->all_deleted); d->all_deleted = ((void*)0); } } } inline VV_LOC int builtin__DenseArray_expand(DenseArray* d) { int old_cap = d->cap; int old_key_size = d->key_bytes * old_cap; int old_value_size = d->value_bytes * old_cap; if (d->cap == d->len) { d->cap += v__rshift_int(d->cap, (u64)3); { // Unsafe block d->keys = builtin__realloc_data(d->keys, old_key_size, d->key_bytes * d->cap); d->values = builtin__realloc_data(d->values, old_value_size, d->value_bytes * d->cap); if (d->deletes != 0) { d->all_deleted = builtin__realloc_data(d->all_deleted, old_cap, d->cap); builtin__vmemset(((voidptr)(d->all_deleted + d->len)), 0, d->cap - d->len); } } } int push_index = d->len; { // Unsafe block if (d->deletes != 0) { d->all_deleted[push_index] = 0; } } d->len++; return push_index; } inline VV_LOC bool builtin__map_eq_string(voidptr a, voidptr b) { return builtin__fast_string_eq(*((string*)(a)), *((string*)(b))); } inline VV_LOC bool builtin__map_eq_int_1(voidptr a, voidptr b) { return *((u8*)(a)) == *((u8*)(b)); } inline VV_LOC bool builtin__map_eq_int_2(voidptr a, voidptr b) { return *((u16*)(a)) == *((u16*)(b)); } inline VV_LOC bool builtin__map_eq_int_4(voidptr a, voidptr b) { return *((u32*)(a)) == *((u32*)(b)); } inline VV_LOC bool builtin__map_eq_int_8(voidptr a, voidptr b) { return *((u64*)(a)) == *((u64*)(b)); } VV_LOC bool builtin__map_map_eq(map a, map b) { if (a.len != b.len) { return false; } for (int i = 0; i < a.key_values.len; i++) { if (!builtin__DenseArray_has_index(&a.key_values, i)) { continue; } voidptr k = builtin__DenseArray_key(&a.key_values, i); if (!builtin__map_exists(&b, k)) { return false; } voidptr va = builtin__DenseArray_value(&a.key_values, i); voidptr vb = builtin__map_get(&b, k, va); if (builtin__vmemcmp(va, vb, a.value_bytes) != 0) { return false; } } return true; } inline VV_LOC void builtin__map_clone_string(voidptr dest, voidptr pkey) { { // Unsafe block string s = *((string*)(pkey)); string cloned = builtin__string_clone(s); builtin__vmemcpy(dest, ((voidptr)(&cloned)), sizeof(string)); } } inline VV_LOC void builtin__map_clone_int_1(voidptr dest, voidptr pkey) { { // Unsafe block *((u8*)(dest)) = *((u8*)(pkey)); } } inline VV_LOC void builtin__map_clone_int_2(voidptr dest, voidptr pkey) { { // Unsafe block *((u16*)(dest)) = *((u16*)(pkey)); } } inline VV_LOC void builtin__map_clone_int_4(voidptr dest, voidptr pkey) { { // Unsafe block *((u32*)(dest)) = *((u32*)(pkey)); } } inline VV_LOC void builtin__map_clone_int_8(voidptr dest, voidptr pkey) { { // Unsafe block *((u64*)(dest)) = *((u64*)(pkey)); } } inline VV_LOC void builtin__map_free_string(voidptr pkey) { builtin__string_free(ADDR(string, (*((string*)(pkey))))); } inline VV_LOC void builtin__map_free_nop(voidptr _d1) { } VV_LOC map builtin__new_map(int key_bytes, int value_bytes, u64 (*hash_fn)(voidptr _d1), bool (*key_eq_fn)(voidptr _d1, voidptr _d2), void (*clone_fn)(voidptr _d1, voidptr _d2), void (*free_fn)(voidptr _d1)) { int metasize = ((int)((u32)(sizeof(u32) * (_const_init_capicity + _const_extra_metas_inc)))); bool has_string_keys = key_bytes > ((int)(sizeof(voidptr))); return ((map){ .key_bytes = key_bytes, .value_bytes = value_bytes, .even_index = _const_init_even_index, .cached_hashbits = _const_max_cached_hashbits, .shift = _const_init_log_capicity, .key_values = builtin__new_dense_array(key_bytes, value_bytes), .metas = ((u32*)(builtin__vcalloc_noscan(metasize))), .extra_metas = _const_extra_metas_inc, .has_string_keys = has_string_keys, .hash_fn = hash_fn, .key_eq_fn = key_eq_fn, .clone_fn = clone_fn, .free_fn = free_fn, .len = 0, }); } VV_LOC map builtin__new_map_init(u64 (*hash_fn)(voidptr _d1), bool (*key_eq_fn)(voidptr _d1, voidptr _d2), void (*clone_fn)(voidptr _d1, voidptr _d2), void (*free_fn)(voidptr _d1), int n, int key_bytes, int value_bytes, voidptr keys, voidptr values) { map out = builtin__new_map(key_bytes, value_bytes, hash_fn, key_eq_fn, clone_fn, free_fn); u8* pkey = ((u8*)(keys)); u8* pval = ((u8*)(values)); for (int _t1 = 0; _t1 < n; ++_t1) { { // Unsafe block builtin__map_set(&out, pkey, pval); pkey = pkey + key_bytes; pval = pval + value_bytes; } } return out; } map builtin__map_move(map* m) { map r = *m; builtin__vmemset(m, 0, ((int)(sizeof(map)))); return r; } void builtin__map_clear(map* m) { { // Unsafe block if (m->key_values.all_deleted != 0) { builtin___v_free(m->key_values.all_deleted); m->key_values.all_deleted = ((void*)0); } builtin__vmemset(m->key_values.keys, 0, m->key_values.key_bytes * m->key_values.cap); builtin__vmemset(m->metas, 0, sizeof(u32) * (m->even_index + 2 + m->extra_metas)); } m->key_values.len = 0; m->key_values.deletes = 0; m->even_index = _const_init_even_index; m->cached_hashbits = _const_max_cached_hashbits; m->shift = _const_init_log_capicity; m->len = 0; } inline VV_LOC multi_return_u32_u32 builtin__map_key_to_index(map* m, voidptr pkey) { if (((voidptr)(m->hash_fn)) == ((void*)0)) { { // Unsafe block u64* p = ((u64*)(m)); u64 prev2 = (((u64*)(((usize)(m)) - ((usize)(16)))))[0]; u64 prev1 = (((u64*)(((usize)(m)) - ((usize)(8)))))[0]; builtin___v_panic(builtin__string_plus_many(34, _MOV((string[34]){_S("map.hash_fn is nil map_ptr="), builtin__usize_str(((usize)(m))), _S(" key_bytes="), builtin__int_str(m->key_bytes), _S(" value_bytes="), builtin__int_str(m->value_bytes), _S(" even_index="), builtin__u32_str(m->even_index), _S(" shift="), builtin__u8_str(m->shift), _S(" metas="), builtin__usize_str(((usize)(m->metas))), _S(" prev2="), builtin__u64_str(prev2), _S(" prev1="), builtin__u64_str(prev1), _S(" w0="), builtin__u64_str(p[0]), _S(" w1="), builtin__u64_str(p[1]), _S(" w2="), builtin__u64_str(p[2]), _S(" w3="), builtin__u64_str(p[3]), _S(" w4="), builtin__u64_str(p[4]), _S(" w5="), builtin__u64_str(p[5]), _S(" w6="), builtin__u64_str(p[6]), _S(" w7="), builtin__u64_str(p[7]), _S(" hash_fn="), builtin__usize_str(((usize)(((voidptr)(m->hash_fn)))))}))); VUNREACHABLE(); } } u64 hash = m->hash_fn(pkey); u64 index = (hash & m->even_index); u64 meta = ((((v__rshift_u64(hash, (u64)m->shift)) & _const_hash_mask)) | _const_probe_inc); return (multi_return_u32_u32){.arg0=((u32)(index)), .arg1=((u32)(meta))}; } inline VV_LOC multi_return_u32_u32 builtin__map_meta_less(map* m, u32 _index, u32 _metas) { u32 index = _index; u32 meta = _metas; for (;;) { if (!(meta < m->metas[index])) break; index += 2; meta += _const_probe_inc; } return (multi_return_u32_u32){.arg0=index, .arg1=meta}; } inline VV_LOC void builtin__map_meta_greater(map* m, u32 _index, u32 _metas, u32 kvi) { u32 meta = _metas; u32 index = _index; u32 kv_index = kvi; for (;;) { if (!(m->metas[index] != 0)) break; if (meta > m->metas[index]) { { // Unsafe block u32 tmp_meta = m->metas[index]; m->metas[index] = meta; meta = tmp_meta; u32 tmp_index = m->metas[index + 1]; m->metas[index + 1] = kv_index; kv_index = tmp_index; } } index += 2; meta += _const_probe_inc; if (index + 2 >= m->even_index + 2 + m->extra_metas) { builtin__map_ensure_extra_metas_grow(m); } } { // Unsafe block m->metas[index] = meta; m->metas[index + 1] = kv_index; } u32 probe_count = (v__rshift_u32(meta, (u64)_const_hashbits)) - 1; builtin__map_ensure_extra_metas(m, probe_count); } VV_LOC void builtin__map_ensure_extra_metas_grow(map* m) { u32 size_of_u32 = sizeof(u32); u32 old_mem_size = (m->even_index + 2 + m->extra_metas); m->extra_metas += _const_extra_metas_inc; u32 mem_size = (m->even_index + 2 + m->extra_metas); { // Unsafe block u8* x = builtin__realloc_data(((byteptr)(m->metas)), ((int)(size_of_u32 * old_mem_size)), ((int)(size_of_u32 * mem_size))); m->metas = ((u32*)(x)); builtin__vmemset(((byteptr)(m->metas)) + (mem_size - _const_extra_metas_inc) * size_of_u32, 0, ((int)(sizeof(u32) * _const_extra_metas_inc))); } } inline VV_LOC void builtin__map_ensure_extra_metas(map* m, u32 probe_count) { if ((v__lshift_u32(probe_count, (u64)1)) == m->extra_metas) { u32 size_of_u32 = sizeof(u32); u32 old_mem_size = (m->even_index + 2 + m->extra_metas); m->extra_metas += _const_extra_metas_inc; u32 mem_size = (m->even_index + 2 + m->extra_metas); { // Unsafe block u8* x = builtin__realloc_data(((byteptr)(m->metas)), ((int)(size_of_u32 * old_mem_size)), ((int)(size_of_u32 * mem_size))); m->metas = ((u32*)(x)); builtin__vmemset(((byteptr)(m->metas)) + (mem_size - _const_extra_metas_inc) * size_of_u32, 0, ((int)(sizeof(u32) * _const_extra_metas_inc))); } if (probe_count == 252) { builtin___v_panic(_S("Probe overflow")); VUNREACHABLE(); } } } VV_LOC void builtin__map_set(map* m, voidptr key, voidptr value) { if (((u32)(5)) * ((u32)(m->len)) > ((u32)(2)) * m->even_index) { builtin__map_expand(m); } multi_return_u32_u32 mr_14546 = builtin__map_key_to_index(m, key); u32 index = mr_14546.arg0; u32 meta = mr_14546.arg1; multi_return_u32_u32 mr_14582 = builtin__map_meta_less(m, index, meta); index = mr_14582.arg0; meta = mr_14582.arg1; for (;;) { if (!(meta == m->metas[index])) break; int kv_index = ((int)(m->metas[index + 1])); voidptr pkey = builtin__DenseArray_key(&m->key_values, kv_index); if (m->key_eq_fn(key, pkey)) { { // Unsafe block voidptr pval = builtin__DenseArray_value(&m->key_values, kv_index); builtin__vmemcpy(pval, value, m->value_bytes); } return; } index += 2; meta += _const_probe_inc; } int kv_index = builtin__DenseArray_expand(&m->key_values); { // Unsafe block voidptr pkey = builtin__DenseArray_key(&m->key_values, kv_index); voidptr pvalue = builtin__DenseArray_value(&m->key_values, kv_index); m->clone_fn(pkey, key); builtin__vmemcpy(pvalue, value, m->value_bytes); } builtin__map_meta_greater(m, index, meta, ((u32)(kv_index))); m->len++; } VV_LOC void builtin__map_expand(map* m) { u32 old_cap = m->even_index; m->even_index = (v__lshift_u32((m->even_index + 2), (u64)1)) - 2; if (m->cached_hashbits == 0) { m->shift += _const_max_cached_hashbits; m->cached_hashbits = _const_max_cached_hashbits; builtin__map_rehash(m); } else { builtin__map_cached_rehash(m, old_cap); m->cached_hashbits--; } } VV_LOC void builtin__map_rehash(map* m) { u32 meta_bytes = sizeof(u32) * (m->even_index + 2 + m->extra_metas); builtin__map_reserve_metas(m, meta_bytes); } VV_LOC void builtin__map_reserve_metas(map* m, u32 meta_bytes) { { // Unsafe block u8* x = builtin__v_realloc(((byteptr)(m->metas)), ((int)(meta_bytes))); m->metas = ((u32*)(x)); builtin__vmemset(m->metas, 0, ((int)(meta_bytes))); } for (int i = 0; i < m->key_values.len; i++) { if (!builtin__DenseArray_has_index(&m->key_values, i)) { continue; } voidptr pkey = builtin__DenseArray_key(&m->key_values, i); multi_return_u32_u32 mr_16309 = builtin__map_key_to_index(m, pkey); u32 index = mr_16309.arg0; u32 meta = mr_16309.arg1; multi_return_u32_u32 mr_16347 = builtin__map_meta_less(m, index, meta); index = mr_16347.arg0; meta = mr_16347.arg1; builtin__map_meta_greater(m, index, meta, ((u32)(i))); } } void builtin__map_reserve(map* m, u32 n) { for (;;) { if (!(((u64)(n)) * 5 > ((u64)(m->even_index)) * 2)) break; builtin__map_expand(m); } } VV_LOC void builtin__map_cached_rehash(map* m, u32 old_cap) { u32* old_metas = m->metas; int metasize = ((int)(sizeof(u32) * (m->even_index + 2 + m->extra_metas))); m->metas = ((u32*)(builtin__vcalloc(metasize))); u32 old_extra_metas = m->extra_metas; for (u32 i = ((u32)(0)); i <= old_cap + old_extra_metas; i += 2) { if (old_metas[i] == 0) { continue; } u32 old_meta = old_metas[i]; u32 old_probe_count = v__lshift_u32(((v__rshift_u32(old_meta, (u64)_const_hashbits)) - 1), (u64)1); u32 old_index = ((i - old_probe_count) & (v__rshift_u32(m->even_index, (u64)1))); u32 index = (((old_index | (v__lshift_u32(old_meta, (u64)m->shift)))) & m->even_index); u32 meta = (((old_meta & _const_hash_mask)) | _const_probe_inc); u32 kv_index = old_metas[i + 1]; multi_return_u32_u32 mr_17370 = builtin__map_meta_less(m, index, meta); index = mr_17370.arg0; meta = mr_17370.arg1; builtin__map_meta_greater(m, index, meta, kv_index); } builtin___v_free(old_metas); } VV_LOC voidptr builtin__map_get_and_set(map* m, voidptr key, voidptr zero) { for (;;) { multi_return_u32_u32 mr_17776 = builtin__map_key_to_index(m, key); u32 index = mr_17776.arg0; u32 meta = mr_17776.arg1; for (;;) { if (meta == m->metas[index]) { int kv_index = ((int)(m->metas[index + 1])); voidptr pkey = builtin__DenseArray_key(&m->key_values, kv_index); if (m->key_eq_fn(key, pkey)) { voidptr pval = builtin__DenseArray_value(&m->key_values, kv_index); return ((u8*)(pval)); } } index += 2; meta += _const_probe_inc; if (meta > m->metas[index]) { break; } } builtin__map_set(m, key, zero); } return ((void*)0); } VV_LOC voidptr builtin__map_get(map* m, voidptr key, voidptr zero) { if (m->len == 0) { return zero; } multi_return_u32_u32 mr_18537 = builtin__map_key_to_index(m, key); u32 index = mr_18537.arg0; u32 meta = mr_18537.arg1; for (;;) { if (meta == m->metas[index]) { int kv_index = ((int)(m->metas[index + 1])); voidptr pkey = builtin__DenseArray_key(&m->key_values, kv_index); if (m->key_eq_fn(key, pkey)) { voidptr pval = builtin__DenseArray_value(&m->key_values, kv_index); return ((u8*)(pval)); } } index += 2; meta += _const_probe_inc; if (meta > m->metas[index]) { break; } } return zero; } VV_LOC voidptr builtin__map_get_check(map* m, voidptr key) { if (m->len == 0) { return 0; } multi_return_u32_u32 mr_19233 = builtin__map_key_to_index(m, key); u32 index = mr_19233.arg0; u32 meta = mr_19233.arg1; for (;;) { if (meta == m->metas[index]) { int kv_index = ((int)(m->metas[index + 1])); voidptr pkey = builtin__DenseArray_key(&m->key_values, kv_index); if (m->key_eq_fn(key, pkey)) { voidptr pval = builtin__DenseArray_value(&m->key_values, kv_index); return ((u8*)(pval)); } } index += 2; meta += _const_probe_inc; if (meta > m->metas[index]) { break; } } return 0; } VV_LOC bool builtin__map_exists(map* m, voidptr key) { if (m->len == 0) { return false; } multi_return_u32_u32 mr_19778 = builtin__map_key_to_index(m, key); u32 index = mr_19778.arg0; u32 meta = mr_19778.arg1; for (;;) { if (meta == m->metas[index]) { int kv_index = ((int)(m->metas[index + 1])); voidptr pkey = builtin__DenseArray_key(&m->key_values, kv_index); if (m->key_eq_fn(key, pkey)) { return true; } } index += 2; meta += _const_probe_inc; if (meta > m->metas[index]) { break; } } return false; } inline VV_LOC void builtin__DenseArray_delete(DenseArray* d, int i) { if (i == d->len - 1) { d->len--; builtin__DenseArray_trim_deleted_tail(d); return; } if (d->deletes == 0) { d->all_deleted = builtin__vcalloc(d->cap); } d->deletes++; { // Unsafe block d->all_deleted[i] = 1; } } void builtin__map_delete(map* m, voidptr key) { multi_return_u32_u32 mr_20483 = builtin__map_key_to_index(m, key); u32 index = mr_20483.arg0; u32 meta = mr_20483.arg1; multi_return_u32_u32 mr_20519 = builtin__map_meta_less(m, index, meta); index = mr_20519.arg0; meta = mr_20519.arg1; for (;;) { if (!(meta == m->metas[index])) break; int kv_index = ((int)(m->metas[index + 1])); voidptr pkey = builtin__DenseArray_key(&m->key_values, kv_index); if (m->key_eq_fn(key, pkey)) { for (;;) { if (!((v__rshift_u32(m->metas[index + 2], (u64)_const_hashbits)) > 1)) break; { // Unsafe block m->metas[index] = m->metas[index + 2] - _const_probe_inc; m->metas[index + 1] = m->metas[index + 3]; } index += 2; } m->len--; builtin__DenseArray_delete(&m->key_values, kv_index); { // Unsafe block m->metas[index] = 0; m->free_fn(pkey); builtin__vmemset(pkey, 0, m->key_bytes); } if (m->key_values.len <= 32) { return; } if (_us32_ge(m->key_values.deletes,(v__rshift_int(m->key_values.len, (u64)1)))) { builtin__DenseArray_zeros_to_end(&m->key_values); builtin__map_rehash(m); } return; } index += 2; meta += _const_probe_inc; } } array builtin__map_keys(map* m) { array keys = builtin____new_array(m->len, 0, m->key_bytes); u8* item = ((u8*)(keys.data)); if (m->key_values.deletes == 0) { for (int i = 0; i < m->key_values.len; i++) { { // Unsafe block voidptr pkey = builtin__DenseArray_key(&m->key_values, i); m->clone_fn(item, pkey); item = item + m->key_bytes; } } return keys; } for (int i = 0; i < m->key_values.len; i++) { if (!builtin__DenseArray_has_index(&m->key_values, i)) { continue; } { // Unsafe block voidptr pkey = builtin__DenseArray_key(&m->key_values, i); m->clone_fn(item, pkey); item = item + m->key_bytes; } } return keys; } array builtin__map_values(map* m) { array values = builtin____new_array(m->len, 0, m->value_bytes); u8* item = ((u8*)(values.data)); if (m->key_values.deletes == 0) { builtin__vmemcpy(item, m->key_values.values, m->value_bytes * m->key_values.len); return values; } for (int i = 0; i < m->key_values.len; i++) { if (!builtin__DenseArray_has_index(&m->key_values, i)) { continue; } { // Unsafe block voidptr pvalue = builtin__DenseArray_value(&m->key_values, i); builtin__vmemcpy(item, pvalue, m->value_bytes); item = item + m->value_bytes; } } return values; } VV_LOC DenseArray builtin__DenseArray_clone(DenseArray* d) { DenseArray res = ((DenseArray){ .key_bytes = d->key_bytes, .value_bytes = d->value_bytes, .cap = d->cap, .len = d->len, .deletes = d->deletes, .all_deleted = ((void*)0), .keys = ((void*)0), .values = ((void*)0), }); { // Unsafe block if (d->deletes != 0) { res.all_deleted = builtin__memdup(d->all_deleted, d->cap); } res.keys = builtin__memdup(d->keys, d->cap * d->key_bytes); res.values = builtin__memdup(d->values, d->cap * d->value_bytes); } return res; } map builtin__map_clone(map* m) { int metasize = ((int)(sizeof(u32) * (m->even_index + 2 + m->extra_metas))); map res = ((map){ .key_bytes = m->key_bytes, .value_bytes = m->value_bytes, .even_index = m->even_index, .cached_hashbits = m->cached_hashbits, .shift = m->shift, .key_values = builtin__DenseArray_clone(&m->key_values), .metas = ((u32*)(builtin__malloc_noscan(metasize))), .extra_metas = m->extra_metas, .has_string_keys = m->has_string_keys, .hash_fn = m->hash_fn, .key_eq_fn = m->key_eq_fn, .clone_fn = m->clone_fn, .free_fn = m->free_fn, .len = m->len, }); builtin__vmemcpy(res.metas, m->metas, metasize); if (!m->has_string_keys) { return res; } for (int i = 0; i < m->key_values.len; ++i) { if (!builtin__DenseArray_has_index(&m->key_values, i)) { continue; } m->clone_fn(builtin__DenseArray_key(&res.key_values, i), builtin__DenseArray_key(&m->key_values, i)); } return res; } void builtin__map_free(map* m) { builtin___v_free(m->metas); { // Unsafe block m->metas = ((void*)0); } if (m->key_values.deletes == 0) { for (int i = 0; i < m->key_values.len; i++) { { // Unsafe block voidptr pkey = builtin__DenseArray_key(&m->key_values, i); m->free_fn(pkey); builtin__vmemset(pkey, 0, m->key_bytes); } } } else { for (int i = 0; i < m->key_values.len; i++) { if (!builtin__DenseArray_has_index(&m->key_values, i)) { continue; } { // Unsafe block voidptr pkey = builtin__DenseArray_key(&m->key_values, i); m->free_fn(pkey); builtin__vmemset(pkey, 0, m->key_bytes); } } } { // Unsafe block if (m->key_values.all_deleted != ((void*)0)) { builtin___v_free(m->key_values.all_deleted); m->key_values.all_deleted = ((void*)0); } if (m->key_values.keys != ((void*)0)) { builtin___v_free(m->key_values.keys); m->key_values.keys = ((void*)0); } if (m->key_values.values != ((void*)0)) { builtin___v_free(m->key_values.values); m->key_values.values = ((void*)0); } m->hash_fn = ((void*)0); m->key_eq_fn = ((void*)0); m->clone_fn = ((void*)0); m->free_fn = ((void*)0); m->key_values.cap = 0; m->key_values.len = 0; m->key_values.deletes = 0; m->even_index = 0; m->cached_hashbits = 0; m->shift = 0; m->extra_metas = 0; m->has_string_keys = false; m->len = 0; } } void builtin__VAssertMetaInfo_free(VAssertMetaInfo* ami) { { // Unsafe block builtin__string_free(&ami->fpath); builtin__string_free(&ami->fn_name); builtin__string_free(&ami->src); builtin__string_free(&ami->op); builtin__string_free(&ami->llabel); builtin__string_free(&ami->rlabel); builtin__string_free(&ami->lvalue); builtin__string_free(&ami->rvalue); builtin__string_free(&ami->message); } } void builtin__IError_free(IError* ie) { { // Unsafe block IError* cie = ((IError*)(ie)); builtin___v_free(cie->_object); } } VNORETURN void builtin__panic_option_not_set(string s) { builtin___v_panic(builtin__string_plus_many(3, _MOV((string[3]){_S("option not set ("), s, _S(")")}))); VUNREACHABLE(); while(1); } VNORETURN void builtin__panic_result_not_set(string s) { builtin___v_panic(builtin__string_plus_many(3, _MOV((string[3]){_S("result not set ("), s, _S(")")}))); VUNREACHABLE(); while(1); } VNORETURN void builtin___v_panic(string s) { #if 0 { } #elif defined(CUSTOM_DEFINE_v2_native_windows_pe_minimal) { } #else { builtin__flush_stdout(); builtin__eprint(_S("V panic: ")); builtin__eprintln(s); builtin__eprint(_S(" v hash: ")); builtin__eprintln(builtin__vcurrent_hash()); #if 1 { builtin__eprint(_S(" pid: ")); ; fprintf(stderr, "%p\n", ((voidptr)(builtin__v_getpid()))); builtin__eprint(_S(" tid: ")); ; fprintf(stderr, "%p\n", ((voidptr)(builtin__v_gettid()))); } #endif builtin__flush_stdout(); #if defined(CUSTOM_DEFINE_exit_after_panic_message) { } #elif defined(CUSTOM_DEFINE_no_backtrace) { exit(1); VUNREACHABLE(); } #elif 0 { } #else { } #endif } #endif exit(1); VUNREACHABLE(); for (;;) { } while(1); } string builtin__c_error_number_str(int errnum) { string err_msg = _S(""); #if 0 { } #else { #if 1 { char* c_msg = strerror(errnum); err_msg = ((string){.str = ((u8*)(c_msg)), .len = ((int)(strlen(c_msg))), .is_lit = 1}); } #endif } #endif return err_msg; } VNORETURN void builtin__panic_n(string s, i64 number1) { builtin___v_panic(builtin__string__plus(s, builtin__impl_i64_to_string(number1))); VUNREACHABLE(); while(1); } VNORETURN void builtin__panic_n2(string s, i64 number1, i64 number2) { builtin___v_panic(builtin__string_plus_many(4, _MOV((string[4]){s, builtin__impl_i64_to_string(number1), _S(", "), builtin__impl_i64_to_string(number2)}))); VUNREACHABLE(); while(1); } VNORETURN VV_LOC void builtin__panic_n3(string s, i64 number1, i64 number2, i64 number3) { builtin___v_panic(builtin__string_plus_many(6, _MOV((string[6]){s, builtin__impl_i64_to_string(number1), _S(", "), builtin__impl_i64_to_string(number2), _S(", "), builtin__impl_i64_to_string(number3)}))); VUNREACHABLE(); while(1); } VNORETURN void builtin__panic_error_number(string basestr, int errnum) { builtin___v_panic(builtin__string__plus(basestr, builtin__c_error_number_str(errnum))); VUNREACHABLE(); while(1); } VV_LOC void builtin__set_stream_unbuffered(FILE* stream) { setvbuf(stream, ((char*)(((void*)0))), _IONBF, ((usize)(0))); } void builtin__eprintln(string s) { #if 0 { } #elif 0 { } #else { builtin__flush_stdout(); builtin__flush_stderr(); builtin___writeln_to_fd(2, s); builtin__flush_stderr(); } #endif } void builtin__eprint(string s) { #if 0 { } #elif 0 { } #else { builtin__flush_stdout(); builtin__flush_stderr(); builtin___write_buf_to_fd(2, s.str, s.len); builtin__flush_stderr(); } #endif } void builtin__flush_stdout(void) { #if defined(CUSTOM_DEFINE_v2_native_windows_pe_minimal) { } #elif 0 { } #elif defined(CUSTOM_DEFINE_builtin_write_buf_to_fd_should_use_c_write) { } #else { fflush(stdout); } #endif } void builtin__flush_stderr(void) { #if defined(CUSTOM_DEFINE_v2_native_windows_pe_minimal) { } #elif 0 { } #elif defined(CUSTOM_DEFINE_builtin_write_buf_to_fd_should_use_c_write) { } #else { fflush(stderr); } #endif } void builtin__unbuffer_stdout(void) { #if 0 { } #elif 0 { } #elif defined(CUSTOM_DEFINE_builtin_write_buf_to_fd_should_use_c_write) { } #else { builtin__set_stream_unbuffered(stdout); } #endif } void builtin__print(string s) { #if 0 { } #elif 0 { } #elif 0 { } #else { builtin___write_buf_to_fd(1, s.str, s.len); } #endif } void builtin__println(string s) { #if 0 { } #elif 0 { } #elif 0 { } #else { builtin___writeln_to_fd(1, s); } #endif } VV_LOC void builtin___writeln_to_fd(int fd, string s) { #if defined(CUSTOM_DEFINE_builtin_writeln_should_write_at_once) { } #else { u8 lf = ((u8)('\n')); builtin___write_buf_to_fd(fd, s.str, s.len); builtin___write_buf_to_fd(fd, &lf, 1); } #endif } VV_LOC void builtin___write_buf_to_fd(int fd, u8* buf, int buf_len) { if (buf_len <= 0) { return; } #if 0 { } #else { u8* ptr = buf; isize remaining_bytes = ((isize)(buf_len)); isize x = ((isize)(0)); #if 0 { } #else { voidptr stream = ((voidptr)(stdout)); if (fd == 2) { stream = ((voidptr)(stderr)); } { // Unsafe block for (;;) { if (!(remaining_bytes > 0)) break; x = ((isize)(fwrite(ptr, 1, remaining_bytes, stream))); if (x <= 0) { break; } ptr += x; remaining_bytes -= x; } } } #endif } #endif } string builtin__reuse_data_as_string(Array_u8 buffer) { return ((string){.str = buffer.data, .len = buffer.len, .is_lit = 1}); } Array_u8 builtin__reuse_string_as_data(string s) { array res = ((array){.data = (voidptr)s.str,.offset = 0,.len = s.len,.cap = 0,.flags = ((ArrayFlags__nogrow | ArrayFlags__noshrink) | ArrayFlags__nofree),.element_size = 1,}); return res; } string builtin__rune_str(rune c) { return builtin__utf32_to_str(((u32)(c))); } string Array_rune_string(Array_rune ra) { strings__Builder sb = strings__new_builder(ra.len); strings__Builder_write_runes(&sb, ra); string res = strings__Builder_str(&sb); strings__Builder_free(&sb); return res; } string builtin__rune_repeat(rune c, int count) { if (count <= 0) { return _S(""); } else if (count == 1) { return builtin__rune_str(c); } Array_fixed_u8_5 buffer = {0}; string res = builtin__utf32_to_str_no_malloc(((u32)(c)), &buffer[0]); return builtin__string_repeat(res, count); } Array_u8 builtin__rune_bytes(rune c) { Array_u8 res = builtin____new_array_with_default(0, 5, sizeof(u8), 0); u8* buf = ((u8*)(res.data)); res.len = builtin__utf32_decode_to_buffer(((u32)(c)), buf); return res; } int builtin__rune_length_in_bytes(rune c) { u32 code = ((u32)(c)); if (code <= 0x7F) { return 1; } else if (code <= 0x7FF) { return 2; } else if (0xD800 <= code && code <= 0xDFFF) { return -1; } else if (code <= 0xFFFF) { return 3; } else if (code <= 0x10FFFF) { return 4; } return -1; } rune builtin__rune_to_upper(rune c) { if (c < 0x80) { if (c >= 'a' && c <= 'z') { return c - 32; } return c; } return builtin__rune_map_to(c, MapMode__to_upper); } rune builtin__rune_to_lower(rune c) { if (c < 0x80) { if (c >= 'A' && c <= 'Z') { return c + 32; } return c; } return builtin__rune_map_to(c, MapMode__to_lower); } rune builtin__rune_to_title(rune c) { if (c < 0x80) { if (c >= 'a' && c <= 'z') { return c - 32; } return c; } return builtin__rune_map_to(c, MapMode__to_title); } VV_LOC rune builtin__rune_map_to(rune c, MapMode mode) { int start = 0; int end = VSAFE_DIV_int(1264 , _const_rune_maps_columns_in_row); for (;;) { if (!(start < end)) break; int middle = VSAFE_DIV_int((start + end) , 2); i32* cur_map = &_const_rune_maps[middle * _const_rune_maps_columns_in_row]; if (c >= ((u32)(*cur_map)) && c <= ((u32)(*(cur_map + 1)))) { i32 offset = ((mode == MapMode__to_upper || mode == MapMode__to_title) ? (*(cur_map + 2)) : (*(cur_map + 3))); if (offset == _const_rune_maps_ul) { rune cnt = VSAFE_MOD_rune(((rune)(c - *cur_map)) , 2); if (mode == MapMode__to_lower) { return c + 1 - cnt; } return c - cnt; } else if (offset == _const_rune_maps_utl) { rune cnt = VSAFE_MOD_rune(((rune)(c - *cur_map)) , 3); if (mode == MapMode__to_upper) { return c - cnt; } else if (mode == MapMode__to_lower) { return c + 2 - cnt; } return c + 1 - cnt; } return (rune)(c + offset); } if (c < ((u32)(*cur_map))) { end = middle; } else { start = middle + 1; } } return c; } VV_LOC int builtin__mapnode_find_key(mapnode* n, string k) { int idx = 0; for (;;) { if (!(idx < n->len && builtin__string__lt(n->keys[builtin__v_fixed_index(idx, 11)], k))) break; idx++; } return idx; } VV_LOC bool builtin__mapnode_remove_key(mapnode* n, string k) { int idx = builtin__mapnode_find_key(n, k); if (idx < n->len && builtin__string__eq(n->keys[builtin__v_fixed_index(idx, 11)], k)) { if (n->children == ((void*)0)) { builtin__mapnode_remove_from_leaf(n, idx); } else { builtin__mapnode_remove_from_non_leaf(n, idx); } return true; } else { if (n->children == ((void*)0)) { return false; } bool flag = (idx == n->len ? (true) : (false)); if (((mapnode*)(n->children[idx]))->len < _const_degree) { builtin__mapnode_fill(n, idx); } mapnode* node = ((mapnode*)(((void*)0))); if (flag && idx > n->len) { node = ((mapnode*)(n->children[idx - 1])); } else { node = ((mapnode*)(n->children[idx])); } return builtin__mapnode_remove_key(node, k); } return 0; } VV_LOC void builtin__mapnode_remove_from_leaf(mapnode* n, int idx) { for (int i = idx + 1; i < n->len; i++) { n->keys[builtin__v_fixed_index(i - 1, 11)] = n->keys[builtin__v_fixed_index(i, 11)]; n->values[builtin__v_fixed_index(i - 1, 11)] = n->values[builtin__v_fixed_index(i, 11)]; } n->len--; } VV_LOC void builtin__mapnode_remove_from_non_leaf(mapnode* n, int idx) { string k = n->keys[builtin__v_fixed_index(idx, 11)]; if (((mapnode*)(n->children[idx]))->len >= _const_degree) { mapnode* current = ((mapnode*)(n->children[idx])); for (;;) { if (!(current->children != ((void*)0))) break; current = ((mapnode*)(current->children[current->len])); } string predecessor = current->keys[builtin__v_fixed_index(current->len - 1, 11)]; n->keys[builtin__v_fixed_index(idx, 11)] = predecessor; n->values[builtin__v_fixed_index(idx, 11)] = current->values[builtin__v_fixed_index(current->len - 1, 11)]; mapnode* node = ((mapnode*)(n->children[idx])); builtin__mapnode_remove_key(node, predecessor); } else if (((mapnode*)(n->children[idx + 1]))->len >= _const_degree) { mapnode* current = ((mapnode*)(n->children[idx + 1])); for (;;) { if (!(current->children != ((void*)0))) break; current = ((mapnode*)(current->children[0])); } string successor = current->keys[0]; n->keys[builtin__v_fixed_index(idx, 11)] = successor; n->values[builtin__v_fixed_index(idx, 11)] = current->values[0]; mapnode* node = ((mapnode*)(n->children[idx + 1])); builtin__mapnode_remove_key(node, successor); } else { builtin__mapnode_merge(n, idx); mapnode* node = ((mapnode*)(n->children[idx])); builtin__mapnode_remove_key(node, k); } } VV_LOC void builtin__mapnode_fill(mapnode* n, int idx) { if (idx != 0 && ((mapnode*)(n->children[idx - 1]))->len >= _const_degree) { builtin__mapnode_borrow_from_prev(n, idx); } else if (idx != n->len && ((mapnode*)(n->children[idx + 1]))->len >= _const_degree) { builtin__mapnode_borrow_from_next(n, idx); } else if (idx != n->len) { builtin__mapnode_merge(n, idx); } else { builtin__mapnode_merge(n, idx - 1); } } VV_LOC void builtin__mapnode_borrow_from_prev(mapnode* n, int idx) { mapnode* child = ((mapnode*)(n->children[idx])); mapnode* sibling = ((mapnode*)(n->children[idx - 1])); for (int i = child->len - 1; i >= 0; i--) { child->keys[builtin__v_fixed_index(i + 1, 11)] = child->keys[builtin__v_fixed_index(i, 11)]; child->values[builtin__v_fixed_index(i + 1, 11)] = child->values[builtin__v_fixed_index(i, 11)]; } if (child->children != ((void*)0)) { for (int i = child->len; i >= 0; i--) { { // Unsafe block child->children[i + 1] = child->children[i]; } } } child->keys[0] = n->keys[builtin__v_fixed_index(idx - 1, 11)]; child->values[0] = n->values[builtin__v_fixed_index(idx - 1, 11)]; if (child->children != ((void*)0)) { { // Unsafe block child->children[0] = sibling->children[sibling->len]; } } n->keys[builtin__v_fixed_index(idx - 1, 11)] = sibling->keys[builtin__v_fixed_index(sibling->len - 1, 11)]; n->values[builtin__v_fixed_index(idx - 1, 11)] = sibling->values[builtin__v_fixed_index(sibling->len - 1, 11)]; child->len++; sibling->len--; } VV_LOC void builtin__mapnode_borrow_from_next(mapnode* n, int idx) { mapnode* child = ((mapnode*)(n->children[idx])); mapnode* sibling = ((mapnode*)(n->children[idx + 1])); child->keys[builtin__v_fixed_index(child->len, 11)] = n->keys[builtin__v_fixed_index(idx, 11)]; child->values[builtin__v_fixed_index(child->len, 11)] = n->values[builtin__v_fixed_index(idx, 11)]; if (child->children != ((void*)0)) { { // Unsafe block child->children[child->len + 1] = sibling->children[0]; } } n->keys[builtin__v_fixed_index(idx, 11)] = sibling->keys[0]; n->values[builtin__v_fixed_index(idx, 11)] = sibling->values[0]; for (int i = 1; i < sibling->len; i++) { sibling->keys[builtin__v_fixed_index(i - 1, 11)] = sibling->keys[builtin__v_fixed_index(i, 11)]; sibling->values[builtin__v_fixed_index(i - 1, 11)] = sibling->values[builtin__v_fixed_index(i, 11)]; } if (sibling->children != ((void*)0)) { for (int i = 1; i <= sibling->len; i++) { { // Unsafe block sibling->children[i - 1] = sibling->children[i]; } } } child->len++; sibling->len--; } VV_LOC void builtin__mapnode_merge(mapnode* n, int idx) { mapnode* child = ((mapnode*)(n->children[idx])); mapnode* sibling = ((mapnode*)(n->children[idx + 1])); child->keys[builtin__v_fixed_index(_const_mid_index, 11)] = n->keys[builtin__v_fixed_index(idx, 11)]; child->values[builtin__v_fixed_index(_const_mid_index, 11)] = n->values[builtin__v_fixed_index(idx, 11)]; for (int i = 0; i < sibling->len; ++i) { child->keys[builtin__v_fixed_index(i + _const_degree, 11)] = sibling->keys[builtin__v_fixed_index(i, 11)]; child->values[builtin__v_fixed_index(i + _const_degree, 11)] = sibling->values[builtin__v_fixed_index(i, 11)]; } if (child->children != ((void*)0)) { for (int i = 0; i <= sibling->len; i++) { { // Unsafe block child->children[i + _const_degree] = sibling->children[i]; } } } for (int i = idx + 1; i < n->len; i++) { n->keys[builtin__v_fixed_index(i - 1, 11)] = n->keys[builtin__v_fixed_index(i, 11)]; n->values[builtin__v_fixed_index(i - 1, 11)] = n->values[builtin__v_fixed_index(i, 11)]; } for (int i = idx + 2; i <= n->len; i++) { { // Unsafe block n->children[i - 1] = n->children[i]; } } child->len += sibling->len + 1; n->len--; } void builtin__SortedMap_delete(SortedMap* m, string key) { if (m->root->len == 0) { return; } bool removed = builtin__mapnode_remove_key(m->root, key); if (removed) { m->len--; } if (m->root->len == 0) { if (m->root->children == ((void*)0)) { return; } else { m->root = ((mapnode*)(m->root->children[0])); } } } VV_LOC int builtin__mapnode_subkeys(mapnode* n, Array_string* keys, int at) { int position = at; if (n->children != ((void*)0)) { for (int i = 0; i < n->len; ++i) { mapnode* child = ((mapnode*)(n->children[i])); position += builtin__mapnode_subkeys(child, keys, position); builtin__array_set(keys, position, &(string[]) { n->keys[builtin__v_fixed_index(i, 11)] }); position++; } mapnode* child = ((mapnode*)(n->children[n->len])); position += builtin__mapnode_subkeys(child, keys, position); } else { for (int i = 0; i < n->len; ++i) { builtin__array_set(keys, (int)(position + i), &(string[]) { n->keys[builtin__v_fixed_index(i, 11)] }); } position += n->len; } return position - at; } Array_string builtin__SortedMap_keys(SortedMap* m) { Array_string keys = builtin____new_array_with_default(m->len, 0, sizeof(string), &(string[]){_S("")}); if (m->root == ((void*)0) || m->root->len == 0) { return keys; } builtin__mapnode_subkeys(m->root, &keys, 0); return keys; } VV_LOC void builtin__mapnode_free(mapnode* n) { } void builtin__SortedMap_free(SortedMap* m) { if (m->root == ((void*)0)) { return; } builtin__mapnode_free(m->root); } Array_rune builtin__string_runes(string s) { Array_rune runes = builtin____new_array_with_default(0, s.len, sizeof(rune), 0); for (int i = 0; i < s.len; i++) { multi_return_rune_int mr_2797 = builtin__utf8_decode_rune(&s.str[i], s.len - i); rune r = mr_2797.arg0; int char_len = mr_2797.arg1; builtin__array_push((array*)&runes, _MOV((rune[]){ r })); if (char_len > 1) { i += char_len - 1; } } return runes; } Array_string builtin__string_graphemes(string s) { return builtin__string_graphemes_impl(s); } string builtin__cstring_to_vstring(const char* const_s) { string s = builtin__tos2(((byteptr)(const_s))); return builtin__string_clone(s); } string builtin__tos_clone(const u8* const_s) { string s = builtin__tos2(((u8*)(const_s))); return builtin__string_clone(s); } string builtin__tos(u8* s, int len) { if (s == 0) { builtin___v_panic(_S("tos(): nil string")); VUNREACHABLE(); } return ((string){.str = s, .len = len}); } string builtin__tos2(u8* s) { if (s == 0) { builtin___v_panic(_S("tos2: nil string")); VUNREACHABLE(); } return ((string){.str = s, .len = builtin__vstrlen(s)}); } string builtin__tos3(char* s) { if (s == 0) { builtin___v_panic(_S("tos3: nil string")); VUNREACHABLE(); } return ((string){.str = ((u8*)(s)), .len = builtin__vstrlen_char(s)}); } string builtin__tos4(u8* s) { if (s == 0) { return _S(""); } return ((string){.str = s, .len = builtin__vstrlen(s)}); } string builtin__tos5(char* s) { if (s == 0) { return _S(""); } return ((string){.str = ((u8*)(s)), .len = builtin__vstrlen_char(s)}); } string builtin__u8_vstring(u8* bp) { return ((string){.str = bp, .len = builtin__vstrlen(bp)}); } string builtin__u8_vstring_with_len(u8* bp, int len) { return ((string){.str = bp, .len = len, .is_lit = 0}); } string builtin__char_vstring(char* cp) { return ((string){.str = ((u8*)(cp)), .len = builtin__vstrlen_char(cp), .is_lit = 0}); } string builtin__char_vstring_with_len(char* cp, int len) { return ((string){.str = ((u8*)(cp)), .len = len, .is_lit = 0}); } string builtin__u8_vstring_literal(u8* bp) { return ((string){.str = bp, .len = builtin__vstrlen(bp), .is_lit = 1}); } string builtin__u8_vstring_literal_with_len(u8* bp, int len) { return ((string){.str = bp, .len = len, .is_lit = 1}); } string builtin__char_vstring_literal(char* cp) { return ((string){.str = ((u8*)(cp)), .len = builtin__vstrlen_char(cp), .is_lit = 1}); } string builtin__char_vstring_literal_with_len(char* cp, int len) { return ((string){.str = ((u8*)(cp)), .len = len, .is_lit = 1}); } int builtin__string_len_utf8(string s) { int l = 0; int i = 0; for (;;) { if (!(i < s.len)) break; l++; i += ((int)((((v__rshift_u32(((u32)(0xe5000000U)), (u64)(((v__rshift_u8(s.str[i], (u64)3)) & 0x1e)))) & 3)) + 1)); } return l; } bool builtin__string_is_pure_ascii(string s) { for (int i = 0; i < s.len; ++i) { if (s.str[ i] >= 0x80) { return false; } } return true; } string builtin__string_clone(string a) { if (a.len <= 0) { return _S(""); } string _t2 = ((string){.str = builtin__malloc_noscan(a.len + 1), .len = a.len}); string b = _t2; { // Unsafe block builtin__vmemcpy(b.str, a.str, a.len); b.str[a.len] = 0; } return b; } string builtin__string_replace_once(string s, string rep, string with) { int idx = builtin__string_index_(s, rep); if (idx == -1) { return builtin__string_clone(s); } return builtin__string_plus_two(builtin__string_substr_unsafe(s, 0, idx), with, builtin__string_substr_unsafe(s, idx + rep.len, s.len)); } string builtin__string_replace(string s, string rep, string with) { if (s.len == 0 || rep.len == 0 || rep.len > s.len) { return builtin__string_clone(s); } if (!builtin__string_contains(s, rep)) { return builtin__string_clone(s); } int pidxs_len = 0; int pidxs_cap = VSAFE_DIV_int(s.len , rep.len); Array_fixed_int_10 stack_idxs = {0}; int* pidxs = &stack_idxs[0]; if (pidxs_cap > _const_replace_stack_buffer_size) { pidxs = ((int*)(builtin___v_malloc(((int)(sizeof(int))) * pidxs_cap))); } int idx = 0; for (;;) { idx = builtin__string_index_after_(s, rep, idx); if (idx == -1) { break; } { // Unsafe block pidxs[pidxs_len] = idx; pidxs_len++; } idx += rep.len; } if (pidxs_len == 0) { string _t3 = builtin__string_clone(s); { // defer begin if (pidxs_cap > _const_replace_stack_buffer_size) { builtin___v_free(pidxs); } } // defer end return _t3; } int new_len = s.len + pidxs_len * (with.len - rep.len); u8* b = builtin__malloc_noscan(new_len + 1); int b_i = 0; int s_idx = 0; for (int j = 0; j < pidxs_len; ++j) { int rep_pos = pidxs[j]; int before_len = rep_pos - s_idx; builtin__vmemcpy(&b[b_i], &s.str[s_idx], before_len); b_i += before_len; s_idx = rep_pos + rep.len; builtin__vmemcpy(&b[b_i], &with.str[0], with.len); b_i += with.len; } if (s_idx < s.len) { builtin__vmemcpy(&b[b_i], &s.str[s_idx], s.len - s_idx); } { // Unsafe block b[new_len] = 0; string _t4 = builtin__tos(b, new_len); { // defer begin if (pidxs_cap > _const_replace_stack_buffer_size) { builtin___v_free(pidxs); } } // defer end return _t4; } return (string){.str=(byteptr)"", .is_lit=1}; } string builtin__string_replace_each(string s, Array_string vals) { if (s.len == 0 || vals.len == 0) { return builtin__string_clone(s); } if (VSAFE_MOD_int(vals.len , 2) != 0) { builtin__eprintln(_S("string.replace_each(): odd number of strings")); return builtin__string_clone(s); } int new_len = s.len; Array_RepIndex idxs = builtin____new_array_with_default(0, 6, sizeof(RepIndex), 0); int idx = 0; string s_ = builtin__string_clone(s); for (int rep_i = 0; rep_i < vals.len; rep_i += 2) { string rep = ((string*)vals.data)[rep_i]; string with = ((string*)vals.data)[rep_i + 1]; for (;;) { idx = builtin__string_index_after_(s_, rep, idx); if (idx == -1) { break; } for (int i = 0; i < rep.len; ++i) { { // Unsafe block s_.str[(int)(idx + i)] = 0; } } builtin__array_push((array*)&idxs, _MOV((RepIndex[]){ ((RepIndex){.idx = idx,.val_idx = rep_i,}) })); idx += rep.len; new_len += with.len - rep.len; } } if (idxs.len == 0) { string _t4 = builtin__string_clone(s); { // defer begin builtin__array_free(&idxs); } // defer end return _t4; } if (idxs.len > 0) { v_stable_sort(idxs.data, idxs.len, idxs.element_size, compare_11734835982493514523_RepIndex_by_idx_expr_612e6964780a3c0a622e696478_qsort_adapter); } ; u8* buf = builtin__malloc_noscan(new_len + 1); int idx_pos = 0; RepIndex cur_idx = ((RepIndex*)idxs.data)[idx_pos]; int buf_i = 0; for (int i = 0; i < s.len; i++) { if (i == cur_idx.idx) { string rep = ((string*)vals.data)[cur_idx.val_idx]; string with = ((string*)vals.data)[cur_idx.val_idx + 1]; for (int j = 0; j < with.len; ++j) { { // Unsafe block buf[buf_i] = with.str[ j]; } buf_i++; } i += rep.len - 1; idx_pos++; if (idx_pos < idxs.len) { cur_idx = ((RepIndex*)idxs.data)[idx_pos]; } } else { { // Unsafe block buf[buf_i] = s.str[i]; } buf_i++; } } { // Unsafe block buf[new_len] = 0; string _t5 = builtin__tos(buf, new_len); { // defer begin builtin__array_free(&idxs); } // defer end return _t5; } return (string){.str=(byteptr)"", .is_lit=1}; } string builtin__string_format(string s, Array_string args) { if (s.len == 0) { return _S(""); } strings__Builder out = strings__new_builder(s.len); int i = 0; for (;;) { if (!(i < s.len)) break; u8 ch = s.str[ i]; if (ch == '{') { if (i + 1 < s.len && s.str[ i + 1] == '{') { strings__Builder_write_byte(&out, '{'); i += 2; continue; } int j = i + 1; if (j >= s.len || !builtin__u8_is_digit(s.str[ j])) { strings__Builder_write_byte(&out, ch); i++; continue; } int idx = 0; bool overflowed = false; for (;;) { if (!(j < s.len && builtin__u8_is_digit(s.str[ j]))) break; int digit = ((int)((rune)(s.str[ j] - '0'))); if (idx > VSAFE_DIV_int((_const_max_int - digit) , 10)) { overflowed = true; break; } idx = idx * 10 + digit; j++; } if (!overflowed && j < s.len && s.str[ j] == '}') { if (idx < args.len) { strings__Builder_write_string(&out, ((string*)args.data)[idx]); } else { strings__Builder_write_string(&out, builtin__string_substr(s, i, j + 1)); } i = j + 1; continue; } strings__Builder_write_byte(&out, ch); i++; continue; } if (ch == '}' && i + 1 < s.len && s.str[ i + 1] == '}') { strings__Builder_write_byte(&out, '}'); i += 2; continue; } strings__Builder_write_byte(&out, ch); i++; } return strings__Builder_str(&out); } string builtin__string_replace_char(string s, u8 rep, u8 with, int repeat) { #if 1 { if (repeat <= 0) { builtin___v_panic(_S("string.replace_char(): tab length too short")); VUNREACHABLE(); } } #endif if (s.len == 0) { return builtin__string_clone(s); } Array_int idxs = builtin____new_array_with_default(0, v__rshift_int(s.len, (u64)2), sizeof(int), 0); for (int i = 0; i < s.len; ++i) { u8 ch = s.str[i]; if (ch == rep) { builtin__array_push((array*)&idxs, _MOV((int[]){ i })); } } if (idxs.len == 0) { string _t4 = builtin__string_clone(s); { // defer begin builtin__array_free(&idxs); } // defer end return _t4; } int new_len = s.len + idxs.len * (repeat - 1); u8* b = builtin__malloc_noscan(new_len + 1); int b_i = 0; int s_idx = 0; for (int _t5 = 0; _t5 < idxs.len; ++_t5) { int rep_pos = ((int*)idxs.data)[_t5]; for (int i = s_idx; i < rep_pos; ++i) { { // Unsafe block b[b_i] = s.str[ i]; } b_i++; } s_idx = rep_pos + 1; for (int _t6 = 0; _t6 < repeat; ++_t6) { { // Unsafe block b[b_i] = with; } b_i++; } } if (s_idx < s.len) { for (int i = s_idx; i < s.len; ++i) { { // Unsafe block b[b_i] = s.str[ i]; } b_i++; } } { // Unsafe block b[new_len] = 0; string _t7 = builtin__tos(b, new_len); { // defer begin builtin__array_free(&idxs); } // defer end return _t7; } return (string){.str=(byteptr)"", .is_lit=1}; } inline string builtin__string_normalize_tabs(string s, int tab_len) { return builtin__string_replace_char(s, '\t', ' ', tab_len); } string builtin__string_expand_tabs(string s, int tab_len) { if (tab_len <= 0) { return builtin__string_clone(s); } strings__Builder output = strings__new_builder(s.len); int column = 0; RunesIterator _t2 = builtin__string_runes_iterator(s); while (1) { _option_rune _t3 = builtin__RunesIterator_next(&_t2); if (_t3.state != 0) break; rune r = *(rune*)_t3.data; if (r == ('\t')) { int spaces = tab_len - (VSAFE_MOD_int(column , tab_len)); strings__Builder_write_string(&output, builtin__string_repeat(_S(" "), spaces)); column += spaces; } else if (r == ('\n') || r == ('\r')) { strings__Builder_write_rune(&output, r); column = 0; } else { strings__Builder_write_rune(&output, r); column++; } } return strings__Builder_str(&output); } inline bool builtin__string_bool(string s) { return _SLIT_EQ(s.str, s.len, "true") || _SLIT_EQ(s.str, s.len, "t"); } inline i8 builtin__string_i8(string s) { _result_i64 _t2 = strconv__common_parse_int(s, 0, 8, false, false); if (_t2.is_error) { *(i64*) _t2.data = 0; } return ((i8)((*(i64*)_t2.data))); } inline i16 builtin__string_i16(string s) { _result_i64 _t2 = strconv__common_parse_int(s, 0, 16, false, false); if (_t2.is_error) { *(i64*) _t2.data = 0; } return ((i16)((*(i64*)_t2.data))); } inline i32 builtin__string_i32(string s) { _result_i64 _t2 = strconv__common_parse_int(s, 0, 32, false, false); if (_t2.is_error) { *(i64*) _t2.data = 0; } return ((i32)((*(i64*)_t2.data))); } inline int builtin__string_int(string s) { _result_i64 _t2 = strconv__common_parse_int(s, 0, 32, false, false); if (_t2.is_error) { *(i64*) _t2.data = 0; } return ((int)((*(i64*)_t2.data))); } inline i64 builtin__string_i64(string s) { _result_i64 _t2 = strconv__common_parse_int(s, 0, 64, false, false); if (_t2.is_error) { *(i64*) _t2.data = 0; } return (*(i64*)_t2.data); } inline f32 builtin__string_f32(string s) { _result_f64 _t2 = strconv__atof64(s, ((strconv__AtoF64Param){.allow_extra_chars = true,})); if (_t2.is_error) { *(f64*) _t2.data = 0; } return ((f32)((*(f64*)_t2.data))); } inline f64 builtin__string_f64(string s) { _result_f64 _t2 = strconv__atof64(s, ((strconv__AtoF64Param){.allow_extra_chars = true,})); if (_t2.is_error) { *(f64*) _t2.data = 0; } return (*(f64*)_t2.data); } Array_u8 builtin__string_u8_array(string s) { string tmps = builtin__string_replace(s, _S("_"), _S("")); if (tmps.len == 0) { return builtin____new_array_with_default(0, 0, sizeof(u8), 0); } tmps = builtin__string_to_lower_ascii(tmps); if (builtin__string_starts_with(tmps, _S("0x"))) { tmps = builtin__string_substr(tmps, 2, 2147483647); if (tmps.len == 0) { return builtin____new_array_with_default(0, 0, sizeof(u8), 0); } if (!builtin__string_contains_only(tmps, _S("0123456789abcdef"))) { return builtin____new_array_with_default(0, 0, sizeof(u8), 0); } if (VSAFE_MOD_int(tmps.len , 2) == 1) { tmps = builtin__string__plus(_S("0"), tmps); } Array_u8 ret = builtin____new_array_with_default(VSAFE_DIV_int(tmps.len , 2), 0, sizeof(u8), 0); for (int i = 0; i < ret.len; ++i) { _result_u64 _t4 = builtin__string_parse_uint(builtin__string_substr(tmps, 2 * i, 2 * i + 2), 16, 8); if (_t4.is_error) { *(u64*) _t4.data = 0; } builtin__array_set(&ret, i, &(u8[]) { ((u8)((*(u64*)_t4.data))) }); } return ret; } else if (builtin__string_starts_with(tmps, _S("0b"))) { tmps = builtin__string_substr(tmps, 2, 2147483647); if (tmps.len == 0) { return builtin____new_array_with_default(0, 0, sizeof(u8), 0); } if (!builtin__string_contains_only(tmps, _S("01"))) { return builtin____new_array_with_default(0, 0, sizeof(u8), 0); } if (VSAFE_MOD_int(tmps.len , 8) != 0) { tmps = builtin__string__plus(builtin__string_repeat(_S("0"), 8 - VSAFE_MOD_int(tmps.len , 8)), tmps); } Array_u8 ret = builtin____new_array_with_default(VSAFE_DIV_int(tmps.len , 8), 0, sizeof(u8), 0); for (int i = 0; i < ret.len; ++i) { _result_u64 _t8 = builtin__string_parse_uint(builtin__string_substr(tmps, 8 * i, 8 * i + 8), 2, 8); if (_t8.is_error) { *(u64*) _t8.data = 0; } builtin__array_set(&ret, i, &(u8[]) { ((u8)((*(u64*)_t8.data))) }); } return ret; } return builtin____new_array_with_default(0, 0, sizeof(u8), 0); } inline u8 builtin__string_u8(string s) { _result_u64 _t2 = strconv__common_parse_uint(s, 0, 8, false, false); if (_t2.is_error) { *(u64*) _t2.data = 0; } return ((u8)((*(u64*)_t2.data))); } inline u16 builtin__string_u16(string s) { _result_u64 _t2 = strconv__common_parse_uint(s, 0, 16, false, false); if (_t2.is_error) { *(u64*) _t2.data = 0; } return ((u16)((*(u64*)_t2.data))); } inline u32 builtin__string_u32(string s) { _result_u64 _t2 = strconv__common_parse_uint(s, 0, 32, false, false); if (_t2.is_error) { *(u64*) _t2.data = 0; } return ((u32)((*(u64*)_t2.data))); } inline u64 builtin__string_u64(string s) { _result_u64 _t2 = strconv__common_parse_uint(s, 0, 64, false, false); if (_t2.is_error) { *(u64*) _t2.data = 0; } return (*(u64*)_t2.data); } inline _result_u64 builtin__string_parse_uint(string s, int _base, int _bit_size) { return strconv__parse_uint(s, _base, _bit_size); } inline _result_i64 builtin__string_parse_int(string s, int _base, int _bit_size) { return strconv__parse_int(s, _base, _bit_size); } VV_LOC bool builtin__string__eq(string s, string a) { if (s.str == 0) { return a.str == 0 || a.len == 0; } if (s.len != a.len) { return false; } { // Unsafe block return builtin__vmemcmp(s.str, a.str, a.len) == 0; } return 0; } int builtin__string_compare(string s, string a) { int min_len = (s.len < a.len ? (s.len) : (a.len)); for (int i = 0; i < min_len; ++i) { if (s.str[ i] < a.str[ i]) { return -1; } if (s.str[ i] > a.str[ i]) { return 1; } } if (s.len < a.len) { return -1; } if (s.len > a.len) { return 1; } return 0; } VV_LOC bool builtin__string__lt(string s, string a) { for (int i = 0; i < s.len; ++i) { if (i >= a.len || s.str[ i] > a.str[ i]) { return false; } else if (s.str[ i] < a.str[ i]) { return true; } } if (s.len < a.len) { return true; } return false; } VV_LOC string builtin__string__plus(string s, string a) { int slen = (s.len > 0 ? (s.len) : (0)); int alen = (a.len > 0 ? (a.len) : (0)); int new_len = alen + slen; string _t1 = ((string){.str = builtin__malloc_noscan(new_len + 1), .len = new_len}); string res = _t1; { // Unsafe block if (slen > 0) { builtin__vmemcpy(res.str, s.str, slen); } if (alen > 0) { builtin__vmemcpy(res.str + slen, a.str, alen); } res.str[new_len] = 0; } return res; } VV_LOC string builtin__string_plus_many(int data_len, string* input_base) { int new_len = 0; for (int i = 0; i < data_len; i++) { string part = input_base[i]; new_len += (part.len > 0 ? (part.len) : (0)); } string _t1 = ((string){.str = builtin__malloc_noscan(new_len + 1), .len = new_len}); string res = _t1; int offset = 0; { // Unsafe block for (int i = 0; i < data_len; i++) { string part = input_base[i]; int part_len = (part.len > 0 ? (part.len) : (0)); if (part_len > 0) { builtin__vmemcpy(res.str + offset, part.str, part_len); offset += part_len; } } res.str[new_len] = 0; } return res; } VV_LOC string builtin__string_plus_two(string s, string a, string b) { int slen = (s.len > 0 ? (s.len) : (0)); int alen = (a.len > 0 ? (a.len) : (0)); int blen = (b.len > 0 ? (b.len) : (0)); int new_len = alen + blen + slen; string _t1 = ((string){.str = builtin__malloc_noscan(new_len + 1), .len = new_len}); string res = _t1; { // Unsafe block if (slen > 0) { builtin__vmemcpy(res.str, s.str, slen); } if (alen > 0) { builtin__vmemcpy(res.str + slen, a.str, alen); } if (blen > 0) { builtin__vmemcpy(res.str + slen + alen, b.str, blen); } res.str[new_len] = 0; } return res; } Array_string builtin__string_split_any(string s, string delim) { Array_string res = builtin____new_array_with_default(0, 0, sizeof(string), 0); builtin__ArrayFlags_set(&res.flags, ArrayFlags__noslices); int i = 0; if (s.len > 0) { if (delim.len <= 0) { Array_string _t1 = builtin__string_split(s, _S("")); { // defer begin builtin__ArrayFlags_clear(&res.flags, ArrayFlags__noslices); } // defer end return _t1; } for (int index = 0; index < s.len; ++index) { u8 ch = s.str[index]; for (int _t2 = 0; _t2 < delim.len; ++_t2) { u8 delim_ch = delim.str[_t2]; if (ch == delim_ch) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, i, index) })); i = index + 1; break; } } } if (i < s.len) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, i, 2147483647) })); } } Array_string _t5 = res; { // defer begin builtin__ArrayFlags_clear(&res.flags, ArrayFlags__noslices); } // defer end return _t5; } Array_string builtin__string_rsplit_any(string s, string delim) { Array_string res = builtin____new_array_with_default(0, 0, sizeof(string), 0); builtin__ArrayFlags_set(&res.flags, ArrayFlags__noslices); int i = s.len - 1; if (s.len > 0) { if (delim.len <= 0) { Array_string _t1 = builtin__string_rsplit(s, _S("")); { // defer begin builtin__ArrayFlags_clear(&res.flags, ArrayFlags__noslices); } // defer end return _t1; } int rbound = s.len; for (;;) { if (!(i >= 0)) break; for (int _t2 = 0; _t2 < delim.len; ++_t2) { u8 delim_ch = delim.str[_t2]; if (s.str[ i] == delim_ch) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, i + 1, rbound) })); rbound = i; break; } } i--; } if (rbound > 0) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, 0, rbound) })); } } Array_string _t5 = res; { // defer begin builtin__ArrayFlags_clear(&res.flags, ArrayFlags__noslices); } // defer end return _t5; } inline Array_string builtin__string_split(string s, string delim) { return builtin__string_split_nth(s, delim, 0); } inline Array_string builtin__string_rsplit(string s, string delim) { return builtin__string_rsplit_nth(s, delim, 0); } _option_multi_return_string_string builtin__string_split_once(string s, string delim) { Array_string result = builtin__string_split_nth(s, delim, 2); if (result.len != 2) { _option_multi_return_string_string _t1 = (_option_multi_return_string_string){ .state=2, .err=_const_none__, .data={E_STRUCT} }; return _t1; } _option_multi_return_string_string _t2; builtin___option_ok(&(multi_return_string_string[]) { (multi_return_string_string){.arg0=(*(string*)builtin__array_get(result, 0)), .arg1=(*(string*)builtin__array_get(result, 1))} }, (_option*)(&_t2), sizeof(multi_return_string_string)); return _t2; } _option_multi_return_string_string builtin__string_rsplit_once(string s, string delim) { Array_string result = builtin__string_rsplit_nth(s, delim, 2); if (result.len != 2) { _option_multi_return_string_string _t1 = (_option_multi_return_string_string){ .state=2, .err=_const_none__, .data={E_STRUCT} }; return _t1; } _option_multi_return_string_string _t2; builtin___option_ok(&(multi_return_string_string[]) { (multi_return_string_string){.arg0=(*(string*)builtin__array_get(result, 1)), .arg1=(*(string*)builtin__array_get(result, 0))} }, (_option*)(&_t2), sizeof(multi_return_string_string)); return _t2; } Array_string builtin__string_split_n(string s, string delim, int n) { return builtin__string_split_nth(s, delim, n); } Array_string builtin__string_split_nth(string s, string delim, int nth) { Array_string res = builtin____new_array_with_default(0, 0, sizeof(string), 0); builtin__ArrayFlags_set(&res.flags, ArrayFlags__noslices); switch (delim.len) { case 0: { for (int i = 0; i < s.len; ++i) { u8 ch = s.str[i]; if (nth > 0 && res.len == nth - 1) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, i, 2147483647) })); break; } builtin__array_push((array*)&res, _MOV((string[]){ builtin__u8_ascii_str(ch) })); } break; } case 1: { u8 delim_byte = delim.str[ 0]; int start = 0; for (int i = 0; i < s.len; ++i) { u8 ch = s.str[i]; if (ch == delim_byte) { if (nth > 0 && res.len == nth - 1) { break; } builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, start, i) })); start = i + 1; } } if (nth < 1 || res.len < nth) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, start, 2147483647) })); } break; } default: { { int start = 0; for (int i = 0; i + delim.len <= s.len; ) { if (builtin__string__eq(builtin__string_substr_unsafe(s, i, i + delim.len), delim)) { if (nth > 0 && res.len == nth - 1) { break; } builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, start, i) })); i += delim.len; start = i; } else { i++; } } if (nth < 1 || res.len < nth) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, start, 2147483647) })); } break; } } } Array_string _t7 = res; { // defer begin builtin__ArrayFlags_clear(&res.flags, ArrayFlags__noslices); } // defer end return _t7; } Array_string builtin__string_rsplit_nth(string s, string delim, int nth) { Array_string res = builtin____new_array_with_default(0, 0, sizeof(string), 0); builtin__ArrayFlags_set(&res.flags, ArrayFlags__noslices); switch (delim.len) { case 0: { for (int i = s.len - 1; i >= 0; i--) { if (nth > 0 && res.len == nth - 1) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, 0, i + 1) })); break; } builtin__array_push((array*)&res, _MOV((string[]){ builtin__u8_ascii_str(s.str[ i]) })); } break; } case 1: { u8 delim_byte = delim.str[ 0]; int rbound = s.len; for (int i = s.len - 1; i >= 0; i--) { if (s.str[ i] == delim_byte) { if (nth > 0 && res.len == nth - 1) { break; } builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, i + 1, rbound) })); rbound = i; } } if (nth < 1 || res.len < nth) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, 0, rbound) })); } break; } default: { { int rbound = s.len; for (int i = s.len - 1; i >= 0; i--) { bool is_delim = i - delim.len >= 0 && builtin__string__eq(builtin__string_substr(s, i - delim.len, i), delim); if (is_delim) { if (nth > 0 && res.len == nth - 1) { break; } builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, i, rbound) })); i -= delim.len; rbound = i; } } if (nth < 1 || res.len < nth) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, 0, rbound) })); } break; } } } Array_string _t7 = res; { // defer begin builtin__ArrayFlags_clear(&res.flags, ArrayFlags__noslices); } // defer end return _t7; } Array_string builtin__string_split_into_lines(string s) { Array_string res = builtin____new_array_with_default(0, 0, sizeof(string), 0); if (s.len == 0) { return res; } builtin__ArrayFlags_set(&res.flags, ArrayFlags__noslices); rune cr = '\r'; rune lf = '\n'; int line_start = 0; for (int i = 0; i < s.len; i++) { if (line_start <= i) { if (s.str[ i] == lf) { builtin__array_push((array*)&res, _MOV((string[]){ (line_start == i ? (_S("")) : (builtin__string_substr(s, line_start, i))) })); line_start = i + 1; } else if (s.str[ i] == cr) { builtin__array_push((array*)&res, _MOV((string[]){ (line_start == i ? (_S("")) : (builtin__string_substr(s, line_start, i))) })); if ((i + 1) < s.len && s.str[ i + 1] == lf) { line_start = i + 2; } else { line_start = i + 1; } } } } if (line_start < s.len) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, line_start, 2147483647) })); } Array_string _t5 = res; { // defer begin builtin__ArrayFlags_clear(&res.flags, ArrayFlags__noslices); } // defer end return _t5; } Array_string builtin__string_split_by_space(string s) { Array_string res = builtin____new_array_with_default(0, 0, sizeof(string), 0); builtin__ArrayFlags_set(&res.flags, ArrayFlags__noslices); Array_string _t1 = builtin__string_split_any(s, _S(" \n\t\v\f\r")); for (int _t2 = 0; _t2 < _t1.len; ++_t2) { string word = ((string*)_t1.data)[_t2]; if ((word).len != 0) { builtin__array_push((array*)&res, _MOV((string[]){ word })); } } Array_string _t4 = res; { // defer begin builtin__ArrayFlags_clear(&res.flags, ArrayFlags__noslices); } // defer end return _t4; } string builtin__string_substr(string s, int start, int _end) { int end = (_end == _const_max_i64 || _end == _const_max_i32 ? (s.len) : (_end)); #if 1 { if (start > end || start > s.len || end > s.len || start < 0 || end < 0) { builtin___v_panic(builtin__string_plus_many(8, _MOV((string[8]){_S("substr("), builtin__impl_i64_to_string(start), _S(", "), builtin__impl_i64_to_string(end), _S(") out of bounds (len="), builtin__impl_i64_to_string(s.len), _S(") s="), s}))); VUNREACHABLE(); } } #endif int len = end - start; if (len == s.len) { return builtin__string_clone(s); } string _t3 = ((string){.str = builtin__malloc_noscan(len + 1), .len = len}); string res = _t3; { // Unsafe block builtin__vmemcpy(res.str, s.str + start, len); res.str[len] = 0; } return res; } string builtin__string_substr_unsafe(string s, int start, int _end) { int end = (_end == 2147483647 ? (s.len) : (_end)); int len = end - start; if (len == s.len) { return s; } return ((string){.str = s.str + start, .len = len}); } string builtin__string_substr_or(string s, int start, int _end, string fallback) { int end = (_end == _const_max_i64 || _end == _const_max_i32 ? (s.len) : (_end)); if (start < 0 || start > end || end > s.len) { return fallback; } return builtin__string_substr(s, start, end); } _result_string builtin__string_substr_with_check(string s, int start, int _end) { int end = (_end == _const_max_i64 || _end == _const_max_i32 ? (s.len) : (_end)); if (start > end || start > s.len || end > s.len || start < 0 || end < 0) { return (_result_string){ .is_error=true, .err=builtin___v_error(builtin__string_plus_many(7, _MOV((string[7]){_S("substr("), builtin__impl_i64_to_string(start), _S(", "), builtin__impl_i64_to_string(end), _S(") out of bounds (len="), builtin__impl_i64_to_string(s.len), _S(")")}))), .data={E_STRUCT} }; } int len = end - start; if (len == s.len) { _result_string _t2; builtin___result_ok(&(string[]) { builtin__string_clone(s) }, (_result*)(&_t2), sizeof(string)); return _t2; } string _t3 = ((string){.str = builtin__malloc_noscan(len + 1), .len = len}); string res = _t3; { // Unsafe block builtin__vmemcpy(res.str, s.str + start, len); res.str[len] = 0; } _result_string _t4; builtin___result_ok(&(string[]) { res }, (_result*)(&_t4), sizeof(string)); return _t4; } string builtin__string_substr_ni(string s, int _start, int _end) { int start = _start; int end = (_end == _const_max_i64 || _end == _const_max_i32 ? (s.len) : (_end)); if (start < 0) { start = s.len + start; if (start < 0) { start = 0; } } if (end < 0) { end = s.len + end; if (end < 0) { end = 0; } } if (end >= s.len) { end = s.len; } if (start > s.len || end < start) { return _S(""); } int len = end - start; string _t2 = ((string){.str = builtin__malloc_noscan(len + 1), .len = len}); string res = _t2; { // Unsafe block builtin__vmemcpy(res.str, s.str + start, len); res.str[len] = 0; } return res; } int builtin__string_index_(string s, string p) { if (p.len > s.len || p.len == 0 || ((u64)(s.str)) <= 0xFFFF || ((u64)(p.str)) <= 0xFFFF) { return -1; } if (p.len > 2) { return builtin__string_index_kmp(s, p); } int i = 0; for (;;) { if (!(i < s.len)) break; int j = 0; for (;;) { if (!(j < p.len && s.str[i + j] == p.str[j])) break; j++; } if (j == p.len) { return i; } i++; } return -1; } _option_int builtin__string_index(string s, string p) { int idx = builtin__string_index_(s, p); if (idx == -1) { return (_option_int){ .state=2, .err=_const_none__, .data={E_STRUCT} }; } _option_int _t2; builtin___option_ok(&(int[]) { idx }, (_option*)(&_t2), sizeof(int)); return _t2; } inline _option_int builtin__string_last_index(string s, string needle) { int idx = builtin__string_index_last_(s, needle); if (idx == -1) { return (_option_int){ .state=2, .err=_const_none__, .data={E_STRUCT} }; } _option_int _t2; builtin___option_ok(&(int[]) { idx }, (_option*)(&_t2), sizeof(int)); return _t2; } VV_LOC int builtin__string_index_kmp(string s, string p) { if (p.len > s.len) { return -1; } Array_fixed_int_20 stack_prefixes = {0}; int* p_prefixes = &stack_prefixes[0]; if (p.len > _const_kmp_stack_buffer_size) { p_prefixes = ((int*)(builtin__vcalloc(p.len * ((int)(sizeof(int)))))); } int j = 0; for (int i = 1; i < p.len; i++) { for (;;) { if (!(p.str[j] != p.str[i] && j > 0)) break; j = p_prefixes[j - 1]; } if (p.str[j] == p.str[i]) { j++; } { // Unsafe block p_prefixes[i] = j; } } j = 0; for (int i = 0; i < s.len; ++i) { for (;;) { if (!(p.str[j] != s.str[i] && j > 0)) break; j = p_prefixes[j - 1]; } if (p.str[j] == s.str[i]) { j++; } if (j == p.len) { int _t2 = (int)(i - p.len) + 1; { // defer begin if (p.len > _const_kmp_stack_buffer_size) { builtin___v_free(p_prefixes); } } // defer end return _t2; } } int _t3 = -1; { // defer begin if (p.len > _const_kmp_stack_buffer_size) { builtin___v_free(p_prefixes); } } // defer end return _t3; } int builtin__string_index_any(string s, string chars) { for (int i = 0; i < s.len; ++i) { u8 ss = s.str[i]; for (int _t1 = 0; _t1 < chars.len; ++_t1) { u8 c = chars.str[_t1]; if (c == ss) { return i; } } } return -1; } VV_LOC int builtin__string_index_last_(string s, string p) { if (p.len > s.len || p.len == 0) { return -1; } int i = s.len - p.len; for (;;) { if (!(i >= 0)) break; int j = 0; for (;;) { if (!(j < p.len && s.str[i + j] == p.str[j])) break; j++; } if (j == p.len) { return i; } i--; } return -1; } _option_int builtin__string_index_after(string s, string p, int start) { if (p.len > s.len) { return (_option_int){ .state=2, .err=_const_none__, .data={E_STRUCT} }; } int strt = start; if (start < 0) { strt = 0; } if (start >= s.len) { return (_option_int){ .state=2, .err=_const_none__, .data={E_STRUCT} }; } int i = strt; for (;;) { if (!(i < s.len)) break; int j = 0; int ii = i; for (;;) { if (!(j < p.len && s.str[ii] == p.str[j])) break; j++; ii++; } if (j == p.len) { _option_int _t3; builtin___option_ok(&(int[]) { i }, (_option*)(&_t3), sizeof(int)); return _t3; } i++; } return (_option_int){ .state=2, .err=_const_none__, .data={E_STRUCT} }; } int builtin__string_index_after_(string s, string p, int start) { if (p.len > s.len) { return -1; } int strt = start; if (start < 0) { strt = 0; } if (start >= s.len) { return -1; } int i = strt; for (;;) { if (!(i < s.len)) break; int j = 0; int ii = i; for (;;) { if (!(j < p.len && s.str[ii] == p.str[j])) break; j++; ii++; } if (j == p.len) { return i; } i++; } return -1; } int builtin__string_index_u8(string s, u8 c) { for (int i = 0; i < s.len; ++i) { u8 b = s.str[i]; if (b == c) { return i; } } return -1; } inline int builtin__string_last_index_u8(string s, u8 c) { for (int i = s.len - 1; i >= 0; i--) { if (s.str[ i] == c) { return i; } } return -1; } int builtin__string_count(string s, string substr) { if (s.len == 0 || substr.len == 0) { return 0; } if (substr.len > s.len) { return 0; } int n = 0; if (substr.len == 1) { u8 target = substr.str[ 0]; for (int _t3 = 0; _t3 < s.len; ++_t3) { u8 letter = s.str[_t3]; if (letter == target) { n++; } } return n; } int i = 0; for (;;) { i = builtin__string_index_after_(s, substr, i); if (i == -1) { return n; } i += substr.len; n++; } return 0; } bool builtin__string_contains_u8(string s, u8 x) { for (int _t1 = 0; _t1 < s.len; ++_t1) { u8 c = s.str[_t1]; if (x == c) { return true; } } return false; } bool builtin__string_contains(string s, string substr) { if (substr.len == 0) { return true; } if (substr.len == 1) { return builtin__string_contains_u8(s, substr.str[0]); } return builtin__string_index_(s, substr) != -1; } bool builtin__string_contains_any(string s, string chars) { for (int _t1 = 0; _t1 < chars.len; ++_t1) { u8 c = chars.str[_t1]; if (builtin__string_contains_u8(s, c)) { return true; } } return false; } bool builtin__string_contains_only(string s, string chars) { if (chars.len == 0) { return false; } for (int _t2 = 0; _t2 < s.len; ++_t2) { u8 ch = s.str[_t2]; int res = 0; for (int i = 0; i < chars.len && res == 0; i++) { res += (int[]){(ch == chars.str[i])?1:0}[0]; } if (res == 0) { return false; } } return true; } bool builtin__string_contains_any_substr(string s, Array_string substrs) { if (substrs.len == 0) { return true; } for (int _t2 = 0; _t2 < substrs.len; ++_t2) { string sub = ((string*)substrs.data)[_t2]; if (builtin__string_contains(s, sub)) { return true; } } return false; } bool builtin__string_starts_with(string s, string p) { if (p.len > s.len || ((u64)(s.str)) <= 0xFFFF || ((u64)(p.str)) <= 0xFFFF) { return false; } else if (builtin__vmemcmp(s.str, p.str, p.len) == 0) { return true; } return false; } bool builtin__string_ends_with(string s, string p) { if (p.len > s.len || ((u64)(s.str)) <= 0xFFFF || ((u64)(p.str)) <= 0xFFFF) { return false; } else if (builtin__vmemcmp(s.str + s.len - p.len, p.str, p.len) == 0) { return true; } return false; } string builtin__string_to_lower_ascii(string s) { { // Unsafe block u8* b = builtin__malloc_noscan(s.len + 1); for (int i = 0; i < s.len; ++i) { if (s.str[i] >= 'A' && s.str[i] <= 'Z') { b[i] = (u8)(s.str[i] + 32); } else { b[i] = s.str[i]; } } b[s.len] = 0; return builtin__tos(b, s.len); } return (string){.str=(byteptr)"", .is_lit=1}; } string builtin__string_to_lower(string s) { if (builtin__string_is_pure_ascii(s)) { return builtin__string_to_lower_ascii(s); } Array_rune runes = builtin__string_runes(s); for (int i = 0; i < runes.len; ++i) { ((rune*)runes.data)[i] = builtin__rune_to_lower(((rune*)runes.data)[i]); } return Array_rune_string(runes); } bool builtin__string_is_lower(string s) { if ((s).len == 0 || builtin__u8_is_digit(s.str[ 0])) { return false; } for (int i = 0; i < s.len; ++i) { if (s.str[ i] >= 'A' && s.str[ i] <= 'Z') { return false; } } return true; } string builtin__string_to_upper_ascii(string s) { { // Unsafe block u8* b = builtin__malloc_noscan(s.len + 1); for (int i = 0; i < s.len; ++i) { if (s.str[i] >= 'a' && s.str[i] <= 'z') { b[i] = (u8)(s.str[i] - 32); } else { b[i] = s.str[i]; } } b[s.len] = 0; return builtin__tos(b, s.len); } return (string){.str=(byteptr)"", .is_lit=1}; } string builtin__string_to_upper(string s) { if (builtin__string_is_pure_ascii(s)) { return builtin__string_to_upper_ascii(s); } Array_rune runes = builtin__string_runes(s); for (int i = 0; i < runes.len; ++i) { ((rune*)runes.data)[i] = builtin__rune_to_upper(((rune*)runes.data)[i]); } return Array_rune_string(runes); } bool builtin__string_is_upper(string s) { if ((s).len == 0) { return false; } bool has_upper = false; for (int i = 0; i < s.len; ++i) { if (s.str[ i] >= 'a' && s.str[ i] <= 'z') { return false; } if (s.str[ i] >= 'A' && s.str[ i] <= 'Z') { has_upper = true; } } return has_upper; } string builtin__string_capitalize(string s) { if (s.len == 0) { return _S(""); } if (s.len == 1) { return builtin__string_to_upper(builtin__u8_ascii_str(s.str[ 0])); } Array_rune r = builtin__string_runes(s); string letter = builtin__rune_str(((rune*)r.data)[0]); string uletter = builtin__string_to_upper(letter); Array_rune rrest = builtin__array_slice(r, 1, 2147483647); string srest = Array_rune_string(rrest); string res = builtin__string__plus(uletter, srest); return res; } string builtin__string_uncapitalize(string s) { if (s.len == 0) { return _S(""); } if (s.len == 1) { return builtin__string_to_lower(builtin__u8_ascii_str(s.str[ 0])); } Array_rune r = builtin__string_runes(s); string letter = builtin__rune_str(((rune*)r.data)[0]); string lletter = builtin__string_to_lower(letter); Array_rune rrest = builtin__array_slice(r, 1, 2147483647); string srest = Array_rune_string(rrest); string res = builtin__string__plus(lletter, srest); return res; } bool builtin__string_is_capital(string s) { if (s.len == 0 || !(s.str[ 0] >= 'A' && s.str[ 0] <= 'Z')) { return false; } for (int i = 1; i < s.len; ++i) { if (s.str[ i] >= 'A' && s.str[ i] <= 'Z') { return false; } } return true; } bool builtin__string_starts_with_capital(string s) { if (s.len == 0 || !builtin__u8_is_capital(s.str[ 0])) { return false; } return true; } string builtin__string_title(string s) { Array_string words = builtin__string_split(s, _S(" ")); Array_string tit = builtin____new_array_with_default(0, 0, sizeof(string), 0); for (int _t1 = 0; _t1 < words.len; ++_t1) { string word = ((string*)words.data)[_t1]; builtin__array_push((array*)&tit, _MOV((string[]){ builtin__string_capitalize(word) })); } string title = Array_string_join(tit, _S(" ")); return title; } bool builtin__string_is_title(string s) { Array_string words = builtin__string_split(s, _S(" ")); for (int _t1 = 0; _t1 < words.len; ++_t1) { string word = ((string*)words.data)[_t1]; if (!builtin__string_is_capital(word)) { return false; } } return true; } string builtin__string_find_between(string s, string start, string end) { int start_pos = builtin__string_index_(s, start); if (start_pos == -1) { return _S(""); } string val = builtin__string_substr(s, start_pos + start.len, 2147483647); int end_pos = builtin__string_index_(val, end); if (end_pos == -1) { return _S(""); } return builtin__string_substr(val, 0, end_pos); } inline string builtin__string_trim_space(string s) { return builtin__string_trim(s, _S(" \n\t\v\f\r")); } inline string builtin__string_trim_space_left(string s) { return builtin__string_trim_left(s, _S(" \n\t\v\f\r")); } inline string builtin__string_trim_space_right(string s) { return builtin__string_trim_right(s, _S(" \n\t\v\f\r")); } string builtin__string_trim(string s, string cutset) { if ((s).len == 0 || (cutset).len == 0) { return builtin__string_clone(s); } if (builtin__string_is_pure_ascii(cutset)) { return builtin__string_trim_chars(s, cutset, TrimMode__trim_both); } else { return builtin__string_trim_runes(s, cutset, TrimMode__trim_both); } return (string){.str=(byteptr)"", .is_lit=1}; } multi_return_int_int builtin__string_trim_indexes(string s, string cutset) { int pos_left = 0; int pos_right = s.len - 1; bool cs_match = true; for (;;) { if (!(pos_left <= s.len && pos_right >= -1 && cs_match)) break; cs_match = false; for (int _t1 = 0; _t1 < cutset.len; ++_t1) { u8 cs = cutset.str[_t1]; if (s.str[ pos_left] == cs) { pos_left++; cs_match = true; break; } } for (int _t2 = 0; _t2 < cutset.len; ++_t2) { u8 cs = cutset.str[_t2]; if (s.str[ pos_right] == cs) { pos_right--; cs_match = true; break; } } if (pos_left > pos_right) { return (multi_return_int_int){.arg0=0, .arg1=0}; } } return (multi_return_int_int){.arg0=pos_left, .arg1=pos_right + 1}; } VV_LOC string builtin__string_trim_chars(string s, string cutset, TrimMode mode) { int pos_left = 0; int pos_right = s.len - 1; bool cs_match = true; for (;;) { if (!(pos_left <= s.len && pos_right >= -1 && cs_match)) break; cs_match = false; if (mode == TrimMode__trim_left || mode == TrimMode__trim_both) { for (int _t1 = 0; _t1 < cutset.len; ++_t1) { u8 cs = cutset.str[_t1]; if (s.str[ pos_left] == cs) { pos_left++; cs_match = true; break; } } } if (mode == TrimMode__trim_right || mode == TrimMode__trim_both) { for (int _t2 = 0; _t2 < cutset.len; ++_t2) { u8 cs = cutset.str[_t2]; if (s.str[ pos_right] == cs) { pos_right--; cs_match = true; break; } } } if (pos_left > pos_right) { return _S(""); } } return builtin__string_substr(s, pos_left, pos_right + 1); } VV_LOC string builtin__string_trim_runes(string s, string cutset, TrimMode mode) { Array_rune s_runes = builtin__string_runes(s); Array_rune cs_runes = builtin__string_runes(cutset); int pos_left = 0; int pos_right = s_runes.len - 1; bool cs_match = true; for (;;) { if (!(pos_left <= s_runes.len && pos_right >= -1 && cs_match)) break; cs_match = false; if (mode == TrimMode__trim_left || mode == TrimMode__trim_both) { for (int _t1 = 0; _t1 < cs_runes.len; ++_t1) { rune cs = ((rune*)cs_runes.data)[_t1]; if (((rune*)s_runes.data)[pos_left] == cs) { pos_left++; cs_match = true; break; } } } if (mode == TrimMode__trim_right || mode == TrimMode__trim_both) { for (int _t2 = 0; _t2 < cs_runes.len; ++_t2) { rune cs = ((rune*)cs_runes.data)[_t2]; if (((rune*)s_runes.data)[pos_right] == cs) { pos_right--; cs_match = true; break; } } } if (pos_left > pos_right) { return _S(""); } } return Array_rune_string(builtin__array_slice(s_runes, pos_left, pos_right + 1)); } string builtin__string_trim_left(string s, string cutset) { if ((s).len == 0 || (cutset).len == 0) { return builtin__string_clone(s); } if (builtin__string_is_pure_ascii(cutset)) { return builtin__string_trim_chars(s, cutset, TrimMode__trim_left); } else { return builtin__string_trim_runes(s, cutset, TrimMode__trim_left); } return (string){.str=(byteptr)"", .is_lit=1}; } string builtin__string_trim_right(string s, string cutset) { if (s.len < 1 || cutset.len < 1) { return builtin__string_clone(s); } if (cutset.len == 1) { u8 cut = cutset.str[ 0]; int pos_right = s.len - 1; for (;;) { if (!(pos_right >= 0 && s.str[ pos_right] == cut)) break; pos_right--; } if (pos_right < 0) { return _S(""); } return builtin__string_substr(s, 0, pos_right + 1); } if (cutset.len == 2 && builtin__string_is_pure_ascii(cutset)) { u8 cut0 = cutset.str[ 0]; u8 cut1 = cutset.str[ 1]; int pos_right = s.len - 1; for (;;) { if (!(pos_right >= 0 && (s.str[ pos_right] == cut0 || s.str[ pos_right] == cut1))) break; pos_right--; } if (pos_right < 0) { return _S(""); } return builtin__string_substr(s, 0, pos_right + 1); } if (builtin__string_is_pure_ascii(cutset)) { return builtin__string_trim_chars(s, cutset, TrimMode__trim_right); } else { return builtin__string_trim_runes(s, cutset, TrimMode__trim_right); } return (string){.str=(byteptr)"", .is_lit=1}; } string builtin__string_trim_string_left(string s, string str) { if (builtin__string_starts_with(s, str)) { return builtin__string_substr(s, str.len, 2147483647); } return builtin__string_clone(s); } string builtin__string_trim_string_right(string s, string str) { if (builtin__string_ends_with(s, str)) { return builtin__string_substr(s, 0, s.len - str.len); } return builtin__string_clone(s); } int builtin__compare_strings(string* a, string* b) { bool _t2 = true; int_literal _t3 = 0; if (_t2 == (builtin__string__lt(*a, *b))) { _t3 = -1; } else if (_t2 == (builtin__string__lt(*b, *a))) { _t3 = 1; } else { _t3 = 0; }return _t3; } VV_LOC int builtin__compare_strings_by_len(string* a, string* b) { bool _t2 = true; int_literal _t3 = 0; if (_t2 == (a->len < b->len)) { _t3 = -1; } else if (_t2 == (a->len > b->len)) { _t3 = 1; } else { _t3 = 0; }return _t3; } VV_LOC int builtin__compare_lower_strings(string* a, string* b) { string aa = builtin__string_to_lower(*a); string bb = builtin__string_to_lower(*b); return builtin__compare_strings(&aa, &bb); } inline void Array_string_sort_ignore_case(Array_string* s) { if (s->len > 0) { v_stable_sort(s->data, s->len, s->element_size, builtin__compare_lower_strings_qsort_adapter); } ; } inline void Array_string_sort_by_len(Array_string* s) { if (s->len > 0) { v_stable_sort(s->data, s->len, s->element_size, builtin__compare_strings_by_len_qsort_adapter); } ; } inline string builtin__string_str(string s) { return builtin__string_clone(s); } VV_LOC u8 builtin__string_at(string s, int idx) { #if 1 { if (idx < 0 || idx >= s.len) { builtin__panic_n2(_S("string index out of range(idx,s.len):"), idx, s.len); VUNREACHABLE(); } } #endif return s.str[idx]; } VV_LOC u8 builtin__string_at_i64(string s, i64 idx) { #if 1 { if (idx < 0 || idx >= ((i64)(s.len))) { builtin__panic_n2(_S("string index out of range(idx,s.len):"), idx, s.len); VUNREACHABLE(); } } #endif return s.str[((int)(idx))]; } VV_LOC u8 builtin__string_at_u64(string s, u64 idx) { #if 1 { if (idx >= ((u64)(s.len))) { builtin___v_panic(builtin__string_plus_many(4, _MOV((string[4]){_S("string index out of range(idx,s.len): "), builtin__u64_str(idx), _S(", "), builtin__impl_i64_to_string(s.len)}))); VUNREACHABLE(); } } #endif return s.str[((int)(idx))]; } VV_LOC u8 builtin__string_at_ni(string s, int idx) { return builtin__string_at(s, builtin__v_ni_index(idx, s.len)); } VV_LOC _option_u8 builtin__string_at_with_check(string s, int idx) { if (idx < 0 || idx >= s.len) { return (_option_u8){ .state=2, .err=_const_none__, .data={E_STRUCT} }; } { // Unsafe block _option_u8 _t2; builtin___option_ok(&(u8[]) { s.str[idx] }, (_option*)(&_t2), sizeof(u8)); return _t2; } return (_option_u8){.state=2, .err=_const_none__, .data={E_STRUCT}}; } VV_LOC _option_u8 builtin__string_at_with_check_i64(string s, i64 idx) { if (idx < 0 || idx >= ((i64)(s.len))) { return (_option_u8){ .state=2, .err=_const_none__, .data={E_STRUCT} }; } { // Unsafe block _option_u8 _t2; builtin___option_ok(&(u8[]) { s.str[((int)(idx))] }, (_option*)(&_t2), sizeof(u8)); return _t2; } return (_option_u8){.state=2, .err=_const_none__, .data={E_STRUCT}}; } VV_LOC _option_u8 builtin__string_at_with_check_u64(string s, u64 idx) { if (idx >= ((u64)(s.len))) { return (_option_u8){ .state=2, .err=_const_none__, .data={E_STRUCT} }; } { // Unsafe block _option_u8 _t2; builtin___option_ok(&(u8[]) { s.str[((int)(idx))] }, (_option*)(&_t2), sizeof(u8)); return _t2; } return (_option_u8){.state=2, .err=_const_none__, .data={E_STRUCT}}; } VV_LOC _option_u8 builtin__string_at_with_check_ni(string s, int idx) { return builtin__string_at_with_check(s, builtin__v_ni_index(idx, s.len)); } bool builtin__string_is_oct(string str) { int i = 0; if (str.len == 0) { return false; } if (str.str[ i] == '0') { i++; } else if (str.str[ i] == '-' || str.str[ i] == '+') { i++; if (i < str.len && str.str[ i] == '0') { i++; } else { return false; } } else { return false; } if (i < str.len && str.str[ i] == 'o') { i++; } else { return false; } if (i == str.len) { return false; } for (;;) { if (!(i < str.len)) break; if (str.str[ i] < '0' || str.str[ i] > '7') { return false; } i++; } return true; } bool builtin__string_is_bin(string str) { int i = 0; if (str.len == 0) { return false; } if (str.str[ i] == '0') { i++; } else if (str.str[ i] == '-' || str.str[ i] == '+') { i++; if (i < str.len && str.str[ i] == '0') { i++; } else { return false; } } else { return false; } if (i < str.len && str.str[ i] == 'b') { i++; } else { return false; } if (i == str.len) { return false; } for (;;) { if (!(i < str.len)) break; if (str.str[ i] < '0' || str.str[ i] > '1') { return false; } i++; } return true; } bool builtin__string_is_hex(string str) { int i = 0; if (str.len == 0) { return false; } if (str.str[ i] == '0') { i++; } else if (str.str[ i] == '-' || str.str[ i] == '+') { i++; if (i < str.len && str.str[ i] == '0') { i++; } else { return false; } } else { return false; } if (i < str.len && str.str[ i] == 'x') { i++; } else { return false; } if (i == str.len) { return false; } for (;;) { if (!(i < str.len)) break; if ((str.str[ i] < '0' || str.str[ i] > '9') && ((str.str[ i] < 'a' || str.str[ i] > 'f') && (str.str[ i] < 'A' || str.str[ i] > 'F'))) { return false; } i++; } return true; } bool builtin__string_is_int(string str) { int i = 0; if (str.len == 0) { return false; } if ((str.str[ i] != '-' && str.str[ i] != '+') && (!builtin__u8_is_digit(str.str[ i]))) { return false; } else { i++; } if (i == str.len && (!builtin__u8_is_digit(str.str[ i - 1]))) { return false; } for (;;) { if (!(i < str.len)) break; if (str.str[ i] < '0' || str.str[ i] > '9') { return false; } i++; } return true; } inline bool builtin__u8_is_space(u8 c) { return c == 32 || (c > 8 && c < 14) || c == 0x85 || c == 0xa0; } inline bool builtin__u8_is_digit(u8 c) { return c >= '0' && c <= '9'; } inline bool builtin__u8_is_hex_digit(u8 c) { return builtin__u8_is_digit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); } inline bool builtin__u8_is_oct_digit(u8 c) { return c >= '0' && c <= '7'; } inline bool builtin__u8_is_bin_digit(u8 c) { return c == '0' || c == '1'; } inline bool builtin__u8_is_letter(u8 c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } inline bool builtin__u8_is_alnum(u8 c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'); } void builtin__string_free(string* s) { if (s->is_lit == -98761234) { u8* double_free_msg = ((u8*)("double string.free() detected\n")); int double_free_msg_len = builtin__vstrlen(double_free_msg); #if 0 { } #else { builtin___write_buf_to_fd(1, double_free_msg, double_free_msg_len); } #endif return; } if (s->is_lit == 1 || s->str == 0) { return; } { // Unsafe block builtin___v_free(s->str); s->str = ((void*)0); } s->len = 0; s->is_lit = -98761234; } string builtin__string_before(string s, string sub) { int pos = builtin__string_index_(s, sub); if (pos == -1) { return builtin__string_clone(s); } return builtin__string_substr(s, 0, pos); } string builtin__string_all_before(string s, string sub) { int pos = builtin__string_index_(s, sub); if (pos == -1) { return builtin__string_clone(s); } return builtin__string_substr(s, 0, pos); } string builtin__string_all_before_last(string s, string sub) { int pos = builtin__string_index_last_(s, sub); if (pos == -1) { return builtin__string_clone(s); } return builtin__string_substr(s, 0, pos); } string builtin__string_all_after(string s, string sub) { int pos = builtin__string_index_(s, sub); if (pos == -1) { return builtin__string_clone(s); } return builtin__string_substr(s, pos + sub.len, 2147483647); } string builtin__string_all_after_last(string s, string sub) { int pos = builtin__string_index_last_(s, sub); if (pos == -1) { return builtin__string_clone(s); } return builtin__string_substr(s, pos + sub.len, 2147483647); } string builtin__string_all_after_first(string s, string sub) { int pos = builtin__string_index_(s, sub); if (pos == -1) { return builtin__string_clone(s); } return builtin__string_substr(s, pos + sub.len, 2147483647); } inline string builtin__string_after(string s, string sub) { return builtin__string_all_after_last(s, sub); } string builtin__string_after_char(string s, u8 sub) { int pos = -1; for (int i = 0; i < s.len; ++i) { u8 c = s.str[i]; if (c == sub) { pos = i; break; } } if (pos == -1) { return builtin__string_clone(s); } return builtin__string_substr(s, pos + 1, 2147483647); } string Array_string_join(Array_string a, string sep) { if (a.len == 0) { return _S(""); } int len = 0; for (int _t2 = 0; _t2 < a.len; ++_t2) { string val = ((string*)a.data)[_t2]; len += val.len + sep.len; } len -= sep.len; string _t3 = ((string){.str = builtin__malloc_noscan(len + 1), .len = len}); string res = _t3; int idx = 0; for (int i = 0; i < a.len; ++i) { string val = ((string*)a.data)[i]; { // Unsafe block builtin__vmemcpy(((voidptr)(res.str + idx)), val.str, val.len); idx += val.len; } if (i != a.len - 1) { { // Unsafe block builtin__vmemcpy(((voidptr)(res.str + idx)), sep.str, sep.len); idx += sep.len; } } } { // Unsafe block res.str[res.len] = 0; } return res; } inline string Array_string_join_lines(Array_string s) { return Array_string_join(s, _S("\n")); } string builtin__string_reverse(string s) { if (s.len == 0 || s.len == 1) { return builtin__string_clone(s); } string _t2 = ((string){.str = builtin__malloc_noscan(s.len + 1), .len = s.len}); string res = _t2; for (int i = s.len - 1; i >= 0; i--) { { // Unsafe block res.str[s.len - i - 1] = s.str[ i]; } } { // Unsafe block res.str[res.len] = 0; } return res; } string builtin__string_limit(string s, int max) { Array_rune u = builtin__string_runes(s); if (u.len <= max) { return builtin__string_clone(s); } return Array_rune_string(builtin__array_slice(u, 0, max)); } int builtin__string_hash(string s) { u32 h = ((u32)(0)); if (h == 0 && s.len > 0) { for (int _t1 = 0; _t1 < s.len; ++_t1) { u8 c = s.str[_t1]; h = h * 31 + ((u32)(c)); } } return ((int)(h)); } Array_u8 builtin__string_bytes(string s) { if (s.len == 0) { return builtin____new_array_with_default(0, 0, sizeof(u8), 0); } Array_u8 buf = builtin____new_array_with_default(s.len, 0, sizeof(u8), 0); builtin__vmemcpy(buf.data, s.str, s.len); return buf; } string builtin__string_repeat(string s, int count) { if (count <= 0) { return _S(""); } else if (count == 1) { return builtin__string_clone(s); } u8* ret = builtin__malloc_noscan(s.len * count + 1); for (int i = 0; i < count; ++i) { builtin__vmemcpy(ret + (int)(i * s.len), s.str, s.len); } int new_len = s.len * count; { // Unsafe block ret[new_len] = 0; } return builtin__u8_vstring_with_len(ret, new_len); } Array_string builtin__string_fields(string s) { Array_string res = builtin____new_array_with_default(0, 0, sizeof(string), 0); builtin__ArrayFlags_set(&res.flags, ArrayFlags__noslices); int word_start = 0; int word_len = 0; bool is_in_word = false; bool is_space = false; for (int i = 0; i < s.len; ++i) { u8 c = s.str[i]; is_space = (c == 32 || c == 9 || c == 10); if (!is_space) { word_len++; } if (!is_in_word && !is_space) { word_start = i; is_in_word = true; continue; } if (is_space && is_in_word) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, word_start, word_start + word_len) })); is_in_word = false; word_len = 0; word_start = 0; continue; } } if (is_in_word && word_len > 0) { builtin__array_push((array*)&res, _MOV((string[]){ builtin__string_substr(s, word_start, s.len) })); } Array_string _t3 = res; { // defer begin builtin__ArrayFlags_clear(&res.flags, ArrayFlags__noslices); } // defer end return _t3; } inline string builtin__string_strip_margin(string s) { return builtin__string_strip_margin_custom(s, '|'); } string builtin__string_strip_margin_custom(string s, u8 del) { u8 sep = del; if (builtin__u8_is_space(sep)) { builtin__println(_S("Warning: `strip_margin` cannot use white-space as a delimiter")); builtin__println(_S(" Defaulting to `|`")); sep = '|'; } u8* ret = builtin__malloc_noscan(s.len + 1); int count = 0; for (int i = 0; i < s.len; i++) { if (s.str[ i] == 10 || s.str[ i] == 13) { { // Unsafe block ret[count] = s.str[ i]; } count++; if (s.str[ i] == 13 && i < s.len - 1 && s.str[ i + 1] == 10) { { // Unsafe block ret[count] = s.str[ i + 1]; } count++; i++; } for (;;) { if (!(s.str[ i] != sep)) break; i++; if (i >= s.len) { break; } } } else { { // Unsafe block ret[count] = s.str[ i]; } count++; } } { // Unsafe block ret[count] = 0; return builtin__u8_vstring_with_len(ret, count); } return (string){.str=(byteptr)"", .is_lit=1}; } string builtin__string_trim_indent(string s) { Array_string lines = builtin__string_split_into_lines(s); int min_common_indent = ((int)(_const_max_int)); for (int _t1 = 0; _t1 < lines.len; ++_t1) { string line = ((string*)lines.data)[_t1]; if (builtin__string_is_blank(line)) { continue; } int line_indent = builtin__string_indent_width(line); if (line_indent < min_common_indent) { min_common_indent = line_indent; } } if (lines.len > 0 && builtin__string_is_blank((*(string*)builtin__array_first(lines)))) { lines = builtin__array_slice(lines, 1, 2147483647); } if (lines.len > 0 && builtin__string_is_blank((*(string*)builtin__array_last(lines)))) { lines = builtin__array_slice(lines, 0, lines.len - 1); } Array_string trimmed_lines = builtin____new_array_with_default(0, lines.len, sizeof(string), 0); for (int _t2 = 0; _t2 < lines.len; ++_t2) { string line = ((string*)lines.data)[_t2]; if (builtin__string_is_blank(line)) { builtin__array_push((array*)&trimmed_lines, _MOV((string[]){ line })); continue; } builtin__array_push((array*)&trimmed_lines, _MOV((string[]){ builtin__string_substr(line, min_common_indent, 2147483647) })); } return Array_string_join(trimmed_lines, _S("\n")); } int builtin__string_indent_width(string s) { for (int i = 0; i < s.len; ++i) { u8 c = s.str[i]; if (!builtin__u8_is_space(c)) { return i; } } return 0; } bool builtin__string_is_blank(string s) { if (s.len == 0) { return true; } for (int _t2 = 0; _t2 < s.len; ++_t2) { u8 c = s.str[_t2]; if (!builtin__u8_is_space(c)) { return false; } } return true; } bool builtin__string_match_glob(string name, string pattern) { int px = 0; int nx = 0; int next_px = 0; int next_nx = 0; int plen = pattern.len; int nlen = name.len; for (;;) { if (!(px < plen || nx < nlen)) break; if (px < plen) { u8 c = pattern.str[ px]; if (c == ('?')) { if (nx < nlen) { px++; nx++; continue; } } else if (c == ('*')) { next_px = px; next_nx = nx + 1; px++; continue; } else if (c == ('[')) { if (nx < nlen) { u8 wanted_c = name.str[ nx]; bool is_inverted = false; bool inner_match = false; int inner_idx = px + 1; if (inner_idx < plen && pattern.str[ inner_idx] == '^') { is_inverted = true; inner_idx++; } for (; inner_idx < plen && pattern.str[ inner_idx] != ']'; inner_idx++) { if (pattern.str[ inner_idx] == wanted_c) { inner_match = true; } } if (inner_idx < plen && ((inner_match && !is_inverted) || (!inner_match && is_inverted))) { px = inner_idx + 1; nx++; continue; } } } else { if (nx < nlen && name.str[ nx] == c) { px++; nx++; continue; } } } if (0 < next_nx && next_nx <= nlen) { px = next_px; nx = next_nx; continue; } return false; } return true; } inline bool builtin__string_is_ascii(string s) { for (int i = 0; i < s.len; i++) { if (s.str[ i] < ((u8)(' ')) || s.str[ i] > ((u8)('~'))) { return false; } } return true; } bool builtin__string_is_identifier(string s) { if (s.len == 0) { return false; } if (!(builtin__u8_is_letter(s.str[ 0]) || s.str[ 0] == '_')) { return false; } for (int i = 1; i < s.len; i++) { u8 c = s.str[ i]; if (!(builtin__u8_is_letter(c) || builtin__u8_is_digit(c) || c == '_')) { return false; } } return true; } string builtin__string_camel_to_snake(string s) { if (s.len == 0) { return _S(""); } if (s.len == 1) { return builtin__string_to_lower_ascii(s); } u8* b = builtin__malloc_noscan(2 * s.len + 1); int pos = 2; bool prev_is_upper = false; bool prev_inserted_boundary = false; { // Unsafe block if (builtin__u8_is_capital(s.str[ 0])) { b[0] = (u8)(s.str[ 0] + 32); u8 _t3; /* if prepend */ if (builtin__u8_is_capital(s.str[ 1])) { prev_is_upper = true; _t3 = (u8)(s.str[ 1] + 32); goto _t4; }; { _t3 = s.str[ 1]; } _t4: {}; b[1] = _t3; } else { b[0] = s.str[ 0]; if (builtin__u8_is_capital(s.str[ 1])) { prev_is_upper = true; if (s.str[ 0] != '_' && s.len > 2 && !builtin__u8_is_capital(s.str[ 2])) { b[1] = '_'; b[2] = (u8)(s.str[ 1] + 32); pos = 3; } else { b[1] = (u8)(s.str[ 1] + 32); } } else { b[1] = s.str[ 1]; } } } for (int i = 2; i < s.len; i++) { bool has_boundary_before_upper = false; u8 c = s.str[ i]; bool c_is_upper = builtin__u8_is_capital(c); bool c_is_number = builtin__u8_is_digit(c); bool next_is_lower = i + 1 < s.len && builtin__u8_is_letter(s.str[ i + 1]) && !builtin__u8_is_capital(s.str[ i + 1]); bool next2_is_lower = i + 2 < s.len && builtin__u8_is_letter(s.str[ i + 2]) && !builtin__u8_is_capital(s.str[ i + 2]); bool skip_digit = c_is_number && prev_is_upper && !next_is_lower && next2_is_lower; if (c_is_upper && prev_is_upper && i >= 2 && builtin__u8_is_capital(s.str[ i - 2]) && next_is_lower && c != '_') { { // Unsafe block if (b[pos - 1] != '_') { b[pos] = '_'; pos++; } } has_boundary_before_upper = true; } if (((c_is_upper && !prev_is_upper) || (!c_is_upper && prev_is_upper && builtin__u8_is_capital(s.str[ i - 2]) && !prev_inserted_boundary && !skip_digit)) && c != '_') { { // Unsafe block if (b[pos - 1] != '_') { b[pos] = '_'; pos++; } } } u8 lower_c = (c_is_upper ? ((u8)(c + 32)) : (c)); { // Unsafe block b[pos] = lower_c; } prev_is_upper = c_is_upper; prev_inserted_boundary = has_boundary_before_upper; pos++; } { // Unsafe block b[pos] = 0; } return builtin__tos(b, pos); } string builtin__string_snake_to_camel(string s) { if (s.len == 0) { return _S(""); } if (s.len == 1) { return s; } bool need_upper = true; rune upper_c = '_'; u8* b = builtin__malloc_noscan(s.len + 1); int i = 0; for (int _t3 = 0; _t3 < s.len; ++_t3) { u8 c = s.str[_t3]; upper_c = (c >= 'a' && c <= 'z' ? ((u8)(c - 32)) : (c)); if (c == '_') { need_upper = true; } else if (need_upper) { { // Unsafe block b[i] = upper_c; } i++; need_upper = false; } else { { // Unsafe block b[i] = c; } i++; } } { // Unsafe block b[i] = 0; } return builtin__tos(b, i); } string builtin__string_wrap(string s, WrapConfig config) { if (config.width <= 0) { return _S(""); } Array_string words = builtin__string_fields(s); if (words.len == 0) { return _S(""); } strings__Builder sb = strings__new_builder(s.len); strings__Builder_write_string(&sb, (*(string*)builtin__array_get(words, 0))); int space_left = config.width - (*(string*)builtin__array_get(words, 0)).len; for (int i = 1; i < words.len; ++i) { string word = (*(string*)builtin__array_get(words, i)); if (word.len + 1 > space_left) { strings__Builder_write_string(&sb, config.end); strings__Builder_write_string(&sb, word); space_left = config.width - word.len; } else { strings__Builder_write_string(&sb, _S(" ")); strings__Builder_write_string(&sb, word); space_left -= 1 + word.len; } } return strings__Builder_str(&sb); } string builtin__string_hex(string s) { if ((s).len == 0) { return _S(""); } return builtin__data_to_hex_string(s.str, s.len); } VV_LOC string builtin__data_to_hex_string(u8* data, int len) { u8* hex = builtin__malloc_noscan(((u64)(len)) * 2 + 1); int dst = 0; for (int c = 0; c < len; ++c) { u8 b = data[c]; u8 n0 = v__rshift_u8(b, (u64)4); u8 n1 = (b & 0xF); hex[dst] = (n0 < 10 ? ((rune)(n0 + '0')) : ((rune)(n0 + 'W'))); hex[dst + 1] = (n1 < 10 ? ((rune)(n1 + '0')) : ((rune)(n1 + 'W'))); dst += 2; } hex[dst] = 0; return builtin__tos(hex, dst); } RunesIterator builtin__string_runes_iterator(string s) { return ((RunesIterator){.s = s,.i = 0,}); } _option_rune builtin__RunesIterator_next(RunesIterator* ri) { if (ri->i >= ri->s.len) { return (_option_rune){ .state=2, .err=_const_none__, .data={E_STRUCT} }; } multi_return_rune_int mr_82852 = builtin__utf8_decode_rune(&ri->s.str[ri->i], ri->s.len - ri->i); rune r = mr_82852.arg0; int char_len = mr_82852.arg1; ri->i += (char_len > 0 ? (char_len) : (1)); _option_rune _t2; builtin___option_ok(&(rune[]) { r }, (_option*)(&_t2), sizeof(rune)); return _t2; } Array_u8 builtin__byteptr_vbytes(byteptr data, int len) { return builtin__voidptr_vbytes(((voidptr)(data)), len); } string builtin__byteptr_vstring(byteptr bp) { return ((string){.str = bp, .len = builtin__vstrlen(bp)}); } string builtin__byteptr_vstring_with_len(byteptr bp, int len) { return ((string){.str = bp, .len = len, .is_lit = 0}); } string builtin__charptr_vstring(charptr cp) { return ((string){.str = ((byteptr)(cp)), .len = builtin__vstrlen_char(cp), .is_lit = 0}); } string builtin__charptr_vstring_with_len(charptr cp, int len) { return ((string){.str = ((byteptr)(cp)), .len = len, .is_lit = 0}); } string builtin__byteptr_vstring_literal(byteptr bp) { return ((string){.str = bp, .len = builtin__vstrlen(bp), .is_lit = 1}); } string builtin__byteptr_vstring_literal_with_len(byteptr bp, int len) { return ((string){.str = bp, .len = len, .is_lit = 1}); } string builtin__charptr_vstring_literal(charptr cp) { return ((string){.str = ((byteptr)(cp)), .len = builtin__vstrlen_char(cp), .is_lit = 1}); } string builtin__charptr_vstring_literal_with_len(charptr cp, int len) { return ((string){.str = ((byteptr)(cp)), .len = len, .is_lit = 1}); } string builtin__StrIntpType_str(StrIntpType x) { string _t2 = (string){.str=(byteptr)"", .is_lit=1}; switch (x) { case StrIntpType__si_no_str: { _t2 = _S("no_str"); break; } case StrIntpType__si_c: { _t2 = _S("c"); break; } case StrIntpType__si_u8: { _t2 = _S("u8"); break; } case StrIntpType__si_i8: { _t2 = _S("i8"); break; } case StrIntpType__si_u16: { _t2 = _S("u16"); break; } case StrIntpType__si_i16: { _t2 = _S("i16"); break; } case StrIntpType__si_u32: { _t2 = _S("u32"); break; } case StrIntpType__si_i32: { _t2 = _S("i32"); break; } case StrIntpType__si_u64: { _t2 = _S("u64"); break; } case StrIntpType__si_i64: { _t2 = _S("i64"); break; } case StrIntpType__si_f32: { _t2 = _S("f32"); break; } case StrIntpType__si_f64: { _t2 = _S("f64"); break; } case StrIntpType__si_g32: { _t2 = _S("f32"); break; } case StrIntpType__si_g64: { _t2 = _S("f64"); break; } case StrIntpType__si_e32: { _t2 = _S("f32"); break; } case StrIntpType__si_e64: { _t2 = _S("f64"); break; } case StrIntpType__si_s: { _t2 = _S("s"); break; } case StrIntpType__si_p: { _t2 = _S("p"); break; } case StrIntpType__si_r: { _t2 = _S("r"); break; } case StrIntpType__si_vp: { _t2 = _S("vp"); break; } } return _t2; } inline VV_LOC f32 builtin__fabs32(f32 x) { return (x < 0 ? (-x) : (x)); } inline VV_LOC f64 builtin__fabs64(f64 x) { return (x < 0 ? (-x) : (x)); } inline VV_LOC u64 builtin__abs64(i64 x) { return (x < 0 ? (((u64)(-x))) : (((u64)(x)))); } u64 builtin__get_str_intp_u64_format(StrIntpType fmt_type, int in_width, int in_precision, bool in_tail_zeros, bool in_sign, u8 in_pad_ch, int in_base, bool in_upper_case) { u64 width = (in_width != 0 ? (builtin__abs64(in_width)) : (((u64)(0)))); u64 align = (in_width > 0 ? (((u64)(32))) : (((u64)(0)))); u64 upper_case = (in_upper_case ? (((u64)(128))) : (((u64)(0)))); u64 sign = (in_sign ? (((u64)(256))) : (((u64)(0)))); u64 precision = (in_precision != 987698 ? ((v__lshift_u64(((u64)((in_precision & 0x7F))), (u64)9))) : (v__lshift_u64(((u64)(0x7F)), (u64)9))); u32 tail_zeros = (in_tail_zeros ? (v__lshift_u32(((u32)(1)), (u64)16)) : (((u32)(0)))); u64 base = ((u64)(v__lshift_u32(((u32)((in_base & 0xf))), (u64)27))); u64 res = ((u64)(((((((((((((u64)(fmt_type)) & 0x1F)) | align) | upper_case) | sign) | precision) | tail_zeros) | (v__lshift_u64(((u64)((width & 0x3FF))), (u64)17))) | base) | (v__lshift_u64(((u64)(in_pad_ch)), (u64)31))))); return res; } u32 builtin__get_str_intp_u32_format(StrIntpType fmt_type, int in_width, int in_precision, bool in_tail_zeros, bool in_sign, u8 in_pad_ch, int in_base, bool in_upper_case) { u64 width = (in_width != 0 ? (builtin__abs64(in_width)) : (((u32)(0)))); u32 align = (in_width > 0 ? (((u32)(32))) : (((u32)(0)))); u32 upper_case = (in_upper_case ? (((u32)(128))) : (((u32)(0)))); u32 sign = (in_sign ? (((u32)(256))) : (((u32)(0)))); u32 precision = (in_precision != 987698 ? ((v__lshift_u32(((u32)((in_precision & 0x7F))), (u64)9))) : (v__lshift_u32(((u32)(0x7F)), (u64)9))); u32 tail_zeros = (in_tail_zeros ? (v__lshift_u32(((u32)(1)), (u64)16)) : (((u32)(0)))); u32 base = ((u32)(v__lshift_u32(((u32)((in_base & 0xf))), (u64)27))); u32 res = ((u32)(((((((((((((u32)(fmt_type)) & 0x1F)) | align) | upper_case) | sign) | precision) | tail_zeros) | (v__lshift_u32(((u32)((width & 0x3FF))), (u64)17))) | base) | (v__lshift_u32(((u32)((in_pad_ch & 1))), (u64)31))))); return res; } VV_LOC void builtin__StrIntpData_process_str_intp_data(StrIntpData* data, strings__Builder* sb) { u32 x = data->fmt; StrIntpType typ = ((StrIntpType)((x & 0x1F))); int align = ((int)(((v__rshift_u32(x, (u64)5)) & 0x01))); bool upper_case = (((v__rshift_u32(x, (u64)7)) & 0x01)) > 0; int sign = ((int)(((v__rshift_u32(x, (u64)8)) & 0x01))); int precision = ((int)(((v__rshift_u32(x, (u64)9)) & 0x7F))); bool tail_zeros = (((v__rshift_u32(x, (u64)16)) & 0x01)) > 0; int width = ((int)(((i16)(((v__rshift_u32(x, (u64)17)) & 0x3FF))))); int base = (((int)(v__rshift_u32(x, (u64)27))) & 0xF); u8 fmt_pad_ch = ((u8)(((v__rshift_u32(x, (u64)31)) & 0xFF))); bool has_dynamic_width = ((data->dyn_flags & _const_str_intp_has_dynamic_width)) != 0; bool has_dynamic_precision = ((data->dyn_flags & _const_str_intp_has_dynamic_precision)) != 0; if (typ == StrIntpType__si_no_str) { return; } if (base > 0) { base += 2; } if (has_dynamic_width) { width = data->dyn_width; if (width < 0) { width = -width; align = 0; } else if (width > 0) { align = 1; } } if (has_dynamic_precision) { precision = data->dyn_precision; } u8 pad_ch = ((u8)(' ')); if (fmt_pad_ch > 0) { pad_ch = '0'; } int len0_set = (width > 0 ? (width) : (-1)); int len1_set = (has_dynamic_precision ? ((precision >= 0 ? (precision) : (-1))) : precision == 0x7F ? (-1) : (precision)); bool sign_set = sign == 1; strconv__BF_param bf = ((strconv__BF_param){ .pad_ch = pad_ch, .len0 = len0_set, .len1 = len1_set, .positive = true, .sign_flag = sign_set, .align = strconv__Align_text__left, .rm_tail_zero = tail_zeros, }); if (fmt_pad_ch == 0 || pad_ch == '0') { switch (align) { case 0: { bf.align = strconv__Align_text__left; break; } case 1: { bf.align = strconv__Align_text__right; break; } default: { { bf.align = strconv__Align_text__left; break; } } } } else { bf.align = strconv__Align_text__right; } { // Unsafe block if (typ == StrIntpType__si_s) { if (upper_case) { string s = builtin__string_to_upper(data->d.d_s); if (width == 0) { strings__Builder_write_string(sb, s); } else { strconv__format_str_sb(s, bf, sb); } builtin__string_free(&s); } else { if (width == 0) { strings__Builder_write_string(sb, data->d.d_s); } else { strconv__format_str_sb(data->d.d_s, bf, sb); } } return; } if (typ == StrIntpType__si_r) { if (width > 0) { if (upper_case) { string s = builtin__string_to_upper(data->d.d_s); for (int _t1 = 1; _t1 < (1 + ((width > 0 ? (width) : (0)))); ++_t1) { strings__Builder_write_string(sb, s); } builtin__string_free(&s); } else { for (int _t2 = 1; _t2 < (1 + ((width > 0 ? (width) : (0)))); ++_t2) { strings__Builder_write_string(sb, data->d.d_s); } } } return; } if (typ == StrIntpType__si_i8 || typ == StrIntpType__si_i16 || typ == StrIntpType__si_i32 || typ == StrIntpType__si_i64) { i64 d = data->d.d_i64; if (typ == StrIntpType__si_i8) { d = ((i64)(data->d.d_i8)); } else if (typ == StrIntpType__si_i16) { d = ((i64)(data->d.d_i16)); } else if (typ == StrIntpType__si_i32) { d = ((i64)(data->d.d_i32)); } if (base == 0) { if (d < 0) { bf.positive = false; } strconv__format_dec_sb(builtin__abs64(d), bf, sb); } else { if (base == 3) { base = 2; } i64 absd = d; bool write_minus = false; if (d < 0 && pad_ch != ' ') { absd = -d; write_minus = true; } string hx = strconv__format_int(absd, base); if (upper_case) { string tmp = hx; hx = builtin__string_to_upper(hx); builtin__string_free(&tmp); } if (write_minus) { strings__Builder_write_u8(sb, '-'); bf.len0--; } if (width == 0) { strings__Builder_write_string(sb, hx); } else { strconv__format_str_sb(hx, bf, sb); } builtin__string_free(&hx); } return; } if (typ == StrIntpType__si_u8 || typ == StrIntpType__si_u16 || typ == StrIntpType__si_u32 || typ == StrIntpType__si_u64) { u64 d = data->d.d_u64; if (typ == StrIntpType__si_u8) { d = ((u64)(data->d.d_u8)); } else if (typ == StrIntpType__si_u16) { d = ((u64)(data->d.d_u16)); } else if (typ == StrIntpType__si_u32) { d = ((u64)(data->d.d_u32)); } if (base == 0) { strconv__format_dec_sb(d, bf, sb); } else { if (base == 3) { base = 2; } string hx = strconv__format_uint(d, base); if (upper_case) { string tmp = hx; hx = builtin__string_to_upper(hx); builtin__string_free(&tmp); } if (width == 0) { strings__Builder_write_string(sb, hx); } else { strconv__format_str_sb(hx, bf, sb); } builtin__string_free(&hx); } return; } if (typ == StrIntpType__si_p) { u64 d = ((u64)(data->d.d_p)); base = 16; if (base == 0) { if (width == 0) { string d_str = builtin__u64_str(d); strings__Builder_write_string(sb, d_str); builtin__string_free(&d_str); return; } strconv__format_dec_sb(d, bf, sb); } else { string hx = strconv__format_uint(d, base); if (upper_case) { string tmp = hx; hx = builtin__string_to_upper(hx); builtin__string_free(&tmp); } if (width == 0) { strings__Builder_write_string(sb, hx); } else { strconv__format_str_sb(hx, bf, sb); } builtin__string_free(&hx); } return; } bool use_default_str = false; if (width == 0 && precision == 0x7F) { bf.len1 = 3; use_default_str = true; } if (bf.len1 < 0) { bf.len1 = 3; } switch (typ) { case StrIntpType__si_f32: { #if !defined(CUSTOM_DEFINE_nofloat) { if (use_default_str) { string f = builtin__f32_str(data->d.d_f32); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); } else { if (data->d.d_f32 < 0) { bf.positive = false; } string f = strconv__format_fl(data->d.d_f32, bf); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); } } #endif break; } case StrIntpType__si_f64: { #if !defined(CUSTOM_DEFINE_nofloat) { if (use_default_str) { string f = builtin__f64_str(data->d.d_f64); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); } else { if (data->d.d_f64 < 0) { bf.positive = false; } strconv__Float64u _t5 = ((strconv__Float64u){.f = data->d.d_f64,}); strconv__Float64u f_union = _t5; if (f_union.u == _const_strconv__double_minus_zero) { bf.positive = false; } string f = strconv__format_fl(data->d.d_f64, bf); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); } } #endif break; } case StrIntpType__si_g32: { if (use_default_str) { #if !defined(CUSTOM_DEFINE_nofloat) { string f = builtin__f32_strg(data->d.d_f32); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); } #endif } else { if (data->d.d_f32 == _const_strconv__single_plus_zero) { string tmp_str = _S("0"); strconv__format_str_sb(tmp_str, bf, sb); builtin__string_free(&tmp_str); return; } if (data->d.d_f32 == _const_strconv__single_minus_zero) { string tmp_str = _S("-0"); strconv__format_str_sb(tmp_str, bf, sb); builtin__string_free(&tmp_str); return; } if (data->d.d_f32 == _const_strconv__single_plus_infinity) { string tmp_str = _S("+inf"); if (upper_case) { tmp_str = _S("+INF"); } strconv__format_str_sb(tmp_str, bf, sb); builtin__string_free(&tmp_str); } if (data->d.d_f32 == _const_strconv__single_minus_infinity) { string tmp_str = _S("-inf"); if (upper_case) { tmp_str = _S("-INF"); } strconv__format_str_sb(tmp_str, bf, sb); builtin__string_free(&tmp_str); } if (data->d.d_f32 < 0) { bf.positive = false; } f32 d = builtin__fabs32(data->d.d_f32); if (d < ((f32)(999999.0)) && d >= ((f32)(0.00001))) { string f = strconv__format_fl(data->d.d_f32, bf); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); return; } bf.len1--; string f = strconv__format_es(data->d.d_f32, bf); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); } break; } case StrIntpType__si_g64: { if (use_default_str) { #if !defined(CUSTOM_DEFINE_nofloat) { string f = builtin__f64_strg(data->d.d_f64); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); } #endif } else { if (data->d.d_f64 == _const_strconv__double_plus_zero) { string tmp_str = _S("0"); strconv__format_str_sb(tmp_str, bf, sb); builtin__string_free(&tmp_str); return; } if (data->d.d_f64 == _const_strconv__double_minus_zero) { string tmp_str = _S("-0"); strconv__format_str_sb(tmp_str, bf, sb); builtin__string_free(&tmp_str); return; } if (data->d.d_f64 == _const_strconv__double_plus_infinity) { string tmp_str = _S("+inf"); if (upper_case) { tmp_str = _S("+INF"); } strconv__format_str_sb(tmp_str, bf, sb); builtin__string_free(&tmp_str); } if (data->d.d_f64 == _const_strconv__double_minus_infinity) { string tmp_str = _S("-inf"); if (upper_case) { tmp_str = _S("-INF"); } strconv__format_str_sb(tmp_str, bf, sb); builtin__string_free(&tmp_str); } if (data->d.d_f64 < 0) { bf.positive = false; } f64 d = builtin__fabs64(data->d.d_f64); if (d < ((f64)(999999.0)) && d >= ((f64)(0.00001))) { string f = strconv__format_fl(data->d.d_f64, bf); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); return; } bf.len1--; string f = strconv__format_es(data->d.d_f64, bf); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); } break; } case StrIntpType__si_e32: { #if !defined(CUSTOM_DEFINE_nofloat) { if (use_default_str) { string f = builtin__f32_str(data->d.d_f32); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); } else { if (data->d.d_f32 < 0) { bf.positive = false; } string f = strconv__format_es(data->d.d_f32, bf); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); } } #endif break; } case StrIntpType__si_e64: { #if !defined(CUSTOM_DEFINE_nofloat) { if (use_default_str) { string f = builtin__f64_str(data->d.d_f64); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); } else { if (data->d.d_f64 < 0) { bf.positive = false; } string f = strconv__format_es(data->d.d_f64, bf); if (upper_case) { string tmp = f; f = builtin__string_to_upper(f); builtin__string_free(&tmp); } strings__Builder_write_string(sb, f); builtin__string_free(&f); } } #endif break; } case StrIntpType__si_c: { string ss = builtin__utf32_to_str(data->d.d_c); strings__Builder_write_string(sb, ss); builtin__string_free(&ss); break; } case StrIntpType__si_vp: { string ss = builtin__u64_hex(((u64)(data->d.d_vp))); strings__Builder_write_string(sb, ss); builtin__string_free(&ss); break; } case StrIntpType__si_no_str: case StrIntpType__si_u8: case StrIntpType__si_i8: case StrIntpType__si_u16: case StrIntpType__si_i16: case StrIntpType__si_u32: case StrIntpType__si_i32: case StrIntpType__si_u64: case StrIntpType__si_i64: case StrIntpType__si_s: case StrIntpType__si_p: case StrIntpType__si_r: default: { { strings__Builder_write_string(sb, _S("***ERROR!***")); break; } } } } } string builtin__str_intp(int data_len, StrIntpData* input_base) { strings__Builder res = strings__new_builder(64); for (int i = 0; i < data_len; i++) { StrIntpData* data = &input_base[i]; if (data->str.len != 0) { strings__Builder_write_string(&res, data->str); } if (data->fmt != 0) { builtin__StrIntpData_process_str_intp_data(data, (voidptr)&res); } } string ret = strings__Builder_str(&res); strings__Builder_free(&res); return ret; } inline string builtin__str_intp_sq(string in_str) { return builtin__string_plus_many(5, _MOV((string[5]){_S("builtin__str_intp(2, _MOV((StrIntpData[]){{_S(\"\'\"), "), _const_si_s_code, _S(", {.d_s = "), in_str, _S("}, 0, 0, 0},{_S(\"\'\"), 0, {0}, 0, 0, 0}}))")})); } inline string builtin__str_intp_rune(string in_str) { return builtin__string_plus_many(5, _MOV((string[5]){_S("builtin__str_intp(2, _MOV((StrIntpData[]){{_S(\"`\"), "), _const_si_s_code, _S(", {.d_s = "), in_str, _S("}, 0, 0, 0},{_S(\"`\"), 0, {0}, 0, 0, 0}}))")})); } inline string builtin__str_intp_g32(string in_str) { return builtin__string_plus_many(5, _MOV((string[5]){_S("builtin__str_intp(1, _MOV((StrIntpData[]){{_SLIT0, "), _const_si_g32_code, _S(", {.d_f32 = "), in_str, _S(" }, 0, 0, 0}}))")})); } inline string builtin__str_intp_g64(string in_str) { return builtin__string_plus_many(5, _MOV((string[5]){_S("builtin__str_intp(1, _MOV((StrIntpData[]){{_SLIT0, "), _const_si_g64_code, _S(", {.d_f64 = "), in_str, _S(" }, 0, 0, 0}}))")})); } string builtin__str_intp_sub(string base_str, string in_str) { _option_int _t1 = builtin__string_index(base_str, _S("%%")); if (_t1.state != 0) { builtin__eprintln(_S("No string interpolation %% parameters")); builtin___v_exit(1); VUNREACHABLE(); ; } int index = (*(int*)_t1.data); { // Unsafe block string st_str = builtin__string_substr(base_str, 0, index); if (index + 2 < base_str.len) { string en_str = builtin__string_substr(base_str, index + 2, 2147483647); string res_str = builtin__string_plus_many(9, _MOV((string[9]){_S("builtin__str_intp(2, _MOV((StrIntpData[]){{_S(\""), st_str, _S("\"), "), _const_si_s_code, _S(", {.d_s = "), in_str, _S(" }, 0, 0, 0},{_S(\""), en_str, _S("\"), 0, {0}, 0, 0, 0}}))")})); builtin__string_free(&st_str); builtin__string_free(&en_str); return res_str; } string res2_str = builtin__string_plus_many(7, _MOV((string[7]){_S("builtin__str_intp(1, _MOV((StrIntpData[]){{_S(\""), st_str, _S("\"), "), _const_si_s_code, _S(", {.d_s = "), in_str, _S(" }, 0, 0, 0}}))")})); builtin__string_free(&st_str); return res2_str; } return (string){.str=(byteptr)"", .is_lit=1}; } u16* builtin__string_to_wide(string _str, ToWideConfig param) { #if 0 { } #else { Array_rune srunes = builtin__string_runes(_str); { // Unsafe block u16* result = ((u16*)(builtin__vcalloc_noscan((srunes.len + 1) * 2))); for (int i = 0; i < srunes.len; ++i) { rune r = ((rune*)srunes.data)[i]; result[i] = ((u16)(r)); } result[srunes.len] = 0; return result; } } #endif return 0; } string builtin__string_from_wide(u16* _wstr) { #if 0 { } #else { int i = 0; for (;;) { if (!(_wstr[i] != 0)) break; i++; } return builtin__string_from_wide2(_wstr, i); } #endif return (string){.str=(byteptr)"", .is_lit=1}; } string builtin__string_from_wide2(u16* _wstr, int len) { #if 0 { } #else { strings__Builder sb = strings__new_builder(len); for (int i = 0; i < len; i++) { rune u = ((rune)(_wstr[i])); strings__Builder_write_rune(&sb, u); } string res = strings__Builder_str(&sb); strings__Builder_free(&sb); return res; } #endif return (string){.str=(byteptr)"", .is_lit=1}; } Array_u8 builtin__wide_to_ansi(u16* _wstr) { #if 0 { } #else { string s = builtin__string_from_wide(_wstr); Array_u8 str_to = builtin____new_array_with_default(s.len + 1, 0, sizeof(u8), 0); builtin__vmemcpy(str_to.data, s.str, s.len); return str_to; } #endif return builtin____new_array_with_default(0, 0, sizeof(u8), 0); } int builtin__utf8_char_len(u8 b) { return ((int)((((v__rshift_u32(((u32)(0xe5000000U)), (u64)(((v__rshift_u8(b, (u64)3)) & 0x1e)))) & 3)) + 1)); } string builtin__utf32_to_str(u32 code) { { // Unsafe block u8* buffer = builtin__malloc_noscan(5); string res = builtin__utf32_to_str_no_malloc(code, buffer); if (res.len == 0) { builtin___v_free(buffer); } return res; } return (string){.str=(byteptr)"", .is_lit=1}; } string builtin__utf32_to_str_no_malloc(u32 code, u8* buf) { { // Unsafe block int len = builtin__utf32_decode_to_buffer(code, buf); if (len == 0) { return _S(""); } buf[len] = 0; return builtin__tos(buf, len); } return (string){.str=(byteptr)"", .is_lit=1}; } int builtin__utf32_decode_to_buffer(u32 code, u8* buf) { { // Unsafe block int icode = ((int)(code)); u8* buffer = ((u8*)(buf)); if (icode <= 127) { buffer[0] = ((u8)(icode)); return 1; } else if (icode <= 2047) { buffer[0] = (192 | ((u8)(v__rshift_int(icode, (u64)6)))); buffer[1] = (128 | ((u8)((icode & 63)))); return 2; } else if (icode <= 65535) { buffer[0] = (224 | ((u8)(v__rshift_int(icode, (u64)12)))); buffer[1] = (128 | ((((u8)(v__rshift_int(icode, (u64)6))) & 63))); buffer[2] = (128 | ((u8)((icode & 63)))); return 3; } else if (icode <= 1114111) { buffer[0] = (240 | ((u8)(v__rshift_int(icode, (u64)18)))); buffer[1] = (128 | ((((u8)(v__rshift_int(icode, (u64)12))) & 63))); buffer[2] = (128 | ((((u8)(v__rshift_int(icode, (u64)6))) & 63))); buffer[3] = (128 | ((u8)((icode & 63)))); return 4; } } return 0; } int builtin__string_utf32_code(string _rune) { if (_rune.len > 4) { return 0; } return ((int)(builtin__impl_utf8_to_utf32(_rune.str, _rune.len))); } _result_rune Array_u8_utf8_to_utf32(Array_u8 _bytes) { if (_bytes.len > 4) { return (_result_rune){ .is_error=true, .err=builtin___v_error(_S("attempted to decode too many bytes, utf-8 is limited to four bytes maximum")), .data={E_STRUCT} }; } _result_rune _t2; builtin___result_ok(&(rune[]) { builtin__impl_utf8_to_utf32(_bytes.data, _bytes.len) }, (_result*)(&_t2), sizeof(rune)); return _t2; } inline VV_LOC bool builtin__utf8_is_continuation(u8 b) { return ((b & 0xc0)) == 0x80; } VV_LOC multi_return_rune_int builtin__utf8_decode_rune(u8* _bytes, int available_len) { if (available_len <= 0) { return (multi_return_rune_int){.arg0=0, .arg1=0}; } u8 b0 = _bytes[0]; if (b0 < 0x80) { return (multi_return_rune_int){.arg0=((rune)(b0)), .arg1=1}; } if (b0 < 0xc2) { return (multi_return_rune_int){.arg0=_const_utf8_replacement_rune, .arg1=1}; } int _t4; /* if prepend */ if (b0 < 0xe0) { _t4 = 2; goto _t5; }; { if (b0 < 0xf0) { _t4 = 3; goto _t5; }; { if (b0 < 0xf5) { _t4 = 4; goto _t5; }; { return (multi_return_rune_int){.arg0=_const_utf8_replacement_rune, .arg1=1}; } } } _t5: {}; int char_len = _t4; if (available_len < char_len) { return (multi_return_rune_int){.arg0=_const_utf8_replacement_rune, .arg1=1}; } u8 b1 = _bytes[1]; if (!builtin__utf8_is_continuation(b1)) { return (multi_return_rune_int){.arg0=_const_utf8_replacement_rune, .arg1=1}; } if (char_len == 2) { return (multi_return_rune_int){.arg0=((v__lshift_rune(((((rune)(b0)) & 0x1f)), (u64)6)) | ((((rune)(b1)) & 0x3f))), .arg1=2}; } if (b0 == 0xe0 && b1 < 0xa0) { return (multi_return_rune_int){.arg0=_const_utf8_replacement_rune, .arg1=1}; } if (b0 == 0xed && b1 >= 0xa0) { return (multi_return_rune_int){.arg0=_const_utf8_replacement_rune, .arg1=1}; } u8 b2 = _bytes[2]; if (!builtin__utf8_is_continuation(b2)) { return (multi_return_rune_int){.arg0=_const_utf8_replacement_rune, .arg1=1}; } if (char_len == 3) { return (multi_return_rune_int){.arg0=(((v__lshift_rune(((((rune)(b0)) & 0x0f)), (u64)12)) | (v__lshift_rune(((((rune)(b1)) & 0x3f)), (u64)6))) | ((((rune)(b2)) & 0x3f))), .arg1=3}; } if (b0 == 0xf0 && b1 < 0x90) { return (multi_return_rune_int){.arg0=_const_utf8_replacement_rune, .arg1=1}; } if (b0 == 0xf4 && b1 > 0x8f) { return (multi_return_rune_int){.arg0=_const_utf8_replacement_rune, .arg1=1}; } u8 b3 = _bytes[3]; if (!builtin__utf8_is_continuation(b3)) { return (multi_return_rune_int){.arg0=_const_utf8_replacement_rune, .arg1=1}; } return (multi_return_rune_int){.arg0=((((v__lshift_rune(((((rune)(b0)) & 0x07)), (u64)18)) | (v__lshift_rune(((((rune)(b1)) & 0x3f)), (u64)12))) | (v__lshift_rune(((((rune)(b2)) & 0x3f)), (u64)6))) | ((((rune)(b3)) & 0x3f))), .arg1=4}; } VV_LOC rune builtin__impl_utf8_to_utf32(u8* _bytes, int _bytes_len) { if (_bytes_len == 0 || _bytes_len > 4) { return 0; } multi_return_rune_int mr_4267 = builtin__utf8_decode_rune(_bytes, _bytes_len); rune r = mr_4267.arg0; int len = mr_4267.arg1; if (len != _bytes_len) { return _const_utf8_replacement_rune; } return r; } int builtin__utf8_str_visible_length(string s) { return builtin__utf8_grapheme_visible_length(s); } Array_u8 builtin__string_to_ansi_not_null_terminated(string _str) { u16* wstr = builtin__string_to_wide(_str, ((ToWideConfig){.from_ansi = 0,})); Array_u8 ansi = builtin__wide_to_ansi(wstr); if (ansi.len > 0) { ansi.len--; } return ansi; } inline bool builtin__ArrayFlags_is_empty(ArrayFlags* e) { return ((int)(*e)) == 0; } inline bool builtin__ArrayFlags_has(ArrayFlags* e, ArrayFlags flag_) { return ((((int)(*e)) & (((int)(flag_))))) != 0; } inline bool builtin__ArrayFlags_all(ArrayFlags* e, ArrayFlags flag_) { return ((((int)(*e)) & (((int)(flag_))))) == ((int)(flag_)); } inline void builtin__ArrayFlags_set(ArrayFlags* e, ArrayFlags flag_) { { // Unsafe block *e = ((ArrayFlags)((((int)(*e)) | (((int)(flag_)))))); } } inline void builtin__ArrayFlags_set_all(ArrayFlags* e) { { // Unsafe block *e = ((ArrayFlags)(0b1111111)); } } inline void builtin__ArrayFlags_clear(ArrayFlags* e, ArrayFlags flag_) { { // Unsafe block *e = ((ArrayFlags)((((int)(*e)) & ~(((int)(flag_)))))); } } inline void builtin__ArrayFlags_clear_all(ArrayFlags* e) { { // Unsafe block *e = ((ArrayFlags)(0)); } } inline void builtin__ArrayFlags_toggle(ArrayFlags* e, ArrayFlags flag_) { { // Unsafe block *e = ((ArrayFlags)((((int)(*e)) ^ (((int)(flag_)))))); } } inline ArrayFlags builtin__ArrayFlags__static__zero(void) { return ((ArrayFlags)(0)); } f64 math__inf(int sign) { u64 v = (sign >= 0 ? (_const_math__uvinf) : (_const_math__uvneginf)); return math__f64_from_bits(v); } f64 math__nan(void) { return math__f64_from_bits(_const_math__uvnan); } bool math__is_nan(f64 f) { return f != f; } bool math__is_inf(f64 f, int sign) { return (sign >= 0 && f > ((f64)(_const_math__max_f64))) || (sign <= 0 && f < ((f64)(-_const_math__max_f64))); } bool math__is_finite(f64 f) { return !math__is_nan(f) && !math__is_inf(f, 0); } multi_return_f64_int math__normalize(f64 x) { f64 smallest_normal = 2.2250738585072014e-308; if (math__abs_T_f64(x) < smallest_normal) { return (multi_return_f64_int){.arg0=(f64)(x * _const_math__normalize_smallest_mask), .arg1=-52}; } return (multi_return_f64_int){.arg0=x, .arg1=0}; } f64 math__cbrt(f64 a) { f64 x = a; int b1 = 715094163; int b2 = 696219795; f64 c = 5.42857142857142815906e-01; f64 d = -7.05306122448979611050e-01; f64 e_ = 1.41428571428571436819e+00; f64 f = 1.60714285714285720630e+00; f64 g = 3.57142857142857150787e-01; f64 smallest_normal = 2.22507385850720138309e-308; if (x == ((f64)(0.0)) || math__is_nan(x) || math__is_inf(x, 0)) { return x; } bool neg = false; if (x < 0) { x = -x; neg = true; } f64 t = math__f64_from_bits(VSAFE_DIV_u64(math__f64_bits(x) , ((u64)(3))) + (v__lshift_u64(((u64)(b1)), (u64)32))); if (x < smallest_normal) { t = ((f64)(v__lshift_u64(((u64)(1)), (u64)54))); t *= x; t = math__f64_from_bits(VSAFE_DIV_u64(math__f64_bits(t) , ((u64)(3))) + (v__lshift_u64(((u64)(b2)), (u64)32))); } f64 r = t * t / x; f64 s = c + r * t; t *= g + f / (s + e_ + d / s); t = math__f64_from_bits((math__f64_bits(t) & (v__lshift_u64(((u64)(0xffffffffcLL)), (u64)28))) + (v__lshift_u64(((u64)(1)), (u64)30))); s = t * t; r = x / s; f64 w = t + t; r = (r - t) / (w + r); t = t + t * r; if (neg) { t = -t; } return t; } f64 math__mod(f64 x, f64 y) { return math__fmod(x, y); } f64 math__fmod(f64 x, f64 y) { if (y == 0 || math__is_inf(x, 0) || math__is_nan(x) || math__is_nan(y)) { return math__nan(); } f64 abs_y = math__abs_T_f64(y); multi_return_f64_int mr_594 = math__frexp(abs_y); f64 abs_y_fr = mr_594.arg0; int abs_y_exp = mr_594.arg1; f64 r = x; if (x < 0) { r = -x; } for (;;) { if (!(r >= abs_y)) break; multi_return_f64_int mr_680 = math__frexp(r); f64 rfr = mr_680.arg0; int rexp = mr_680.arg1; if (rfr < abs_y_fr) { rexp = rexp - 1; } r = r - math__ldexp(abs_y, rexp - abs_y_exp); } if (x < 0) { r = -r; } return r; } i64 math__gcd(i64 a_, i64 b_) { i64 a = a_; i64 b = b_; if (a < 0) { a = -a; } if (b < 0) { b = -b; } for (;;) { if (!(b != 0)) break; a = VSAFE_MOD_i64(a,b); if (a == 0) { return b; } b = VSAFE_MOD_i64(b,a); } return a; } multi_return_i64_i64_i64 math__egcd(i64 a, i64 b) { i64 old_r = a; i64 r = b; i64 old_s = ((i64)(1)); i64 s = ((i64)(0)); i64 old_t = ((i64)(0)); i64 t = ((i64)(1)); for (;;) { if (!(r != 0)) break; i64 quot = VSAFE_DIV_i64(old_r , r); i64 _var_1339 = old_r; i64 _var_1346 = r; old_r = _var_1346; r = _var_1339%_var_1346; i64 _var_1365 = old_s; i64 _var_1372 = s; old_s = _var_1372; s = _var_1365-quot*_var_1372; i64 _var_1398 = old_t; i64 _var_1405 = t; old_t = _var_1405; t = _var_1398-quot*_var_1405; } return (multi_return_i64_i64_i64){.arg0=(old_r < 0 ? (-old_r) : (old_r)), .arg1=old_s, .arg2=old_t}; } i64 math__lcm(i64 a, i64 b) { if (a == 0) { return a; } i64 res = a * (VSAFE_DIV_i64(b , math__gcd(b, a))); if (res < 0) { return -res; } return res; } f64 math__erf(f64 a) { f64 x = a; f64 very_tiny = 2.848094538889218e-306; f64 small_ = ((f64)(1.0)) / ((f64)(v__lshift_u64(((u64)(1)), (u64)28))); if (math__is_nan(x)) { return math__nan(); } if (math__is_inf(x, 1)) { return 1.0; } if (math__is_inf(x, -1)) { return ((f64)(-1)); } bool neg = false; if (x < 0) { x = -x; neg = true; } if (x < ((f64)(0.84375))) { f64 temp = 0.0; if (x < small_) { if (x < very_tiny) { temp = ((f64)(0.125)) * (((f64)(8.0)) * x + ((f64)(_const_math__efx8)) * x); } else { temp = x + ((f64)(_const_math__efx)) * x; } } else { f64 z = x * x; f64 r = ((f64)(_const_math__pp0)) + z * (((f64)(_const_math__pp1)) + z * (((f64)(_const_math__pp2)) + z * (((f64)(_const_math__pp3)) + z * ((f64)(_const_math__pp4))))); f64 s_ = ((f64)(1.0)) + z * (((f64)(_const_math__qq1)) + z * (((f64)(_const_math__qq2)) + z * (((f64)(_const_math__qq3)) + z * (((f64)(_const_math__qq4)) + z * ((f64)(_const_math__qq5)))))); f64 y = r / s_; temp = x + x * y; } if (neg) { return -temp; } return temp; } if (x < ((f64)(1.25))) { f64 s_ = x - 1; f64 p = ((f64)(_const_math__pa0)) + s_ * (((f64)(_const_math__pa1)) + s_ * (((f64)(_const_math__pa2)) + s_ * (((f64)(_const_math__pa3)) + s_ * (((f64)(_const_math__pa4)) + s_ * (((f64)(_const_math__pa5)) + s_ * ((f64)(_const_math__pa6))))))); f64 q = ((f64)(1.0)) + s_ * (((f64)(_const_math__qa1)) + s_ * (((f64)(_const_math__qa2)) + s_ * (((f64)(_const_math__qa3)) + s_ * (((f64)(_const_math__qa4)) + s_ * (((f64)(_const_math__qa5)) + s_ * ((f64)(_const_math__qa6))))))); if (neg) { return ((f64)(-_const_math__erx)) - p / q; } return ((f64)(_const_math__erx)) + p / q; } if (x >= 6) { if (neg) { return -1; } return 1.0; } f64 s_ = ((f64)(1.0)) / (x * x); f64 r = 0.0; f64 s = 0.0; if (x < ((f64)(2.857142857142857))) { f64 tmp41 = s_ * (((f64)(_const_math__ra5)) + s_ * (((f64)(_const_math__ra6)) + s_ * ((f64)(_const_math__ra7)))); r = ((f64)(_const_math__ra0)) + s_ * (((f64)(_const_math__ra1)) + s_ * (((f64)(_const_math__ra2)) + s_ * (((f64)(_const_math__ra3)) + s_ * (((f64)(_const_math__ra4)) + tmp41)))); f64 tmp42 = s_ * (((f64)(_const_math__sa5)) + s_ * (((f64)(_const_math__sa6)) + s_ * (((f64)(_const_math__sa7)) + s_ * ((f64)(_const_math__sa8))))); s = ((f64)(1.0)) + s_ * (((f64)(_const_math__sa1)) + s_ * (((f64)(_const_math__sa2)) + s_ * (((f64)(_const_math__sa3)) + s_ * (((f64)(_const_math__sa4)) + tmp42)))); } else { f64 tmp31 = ((f64)(_const_math__rb4)) + s_ * (((f64)(_const_math__rb5)) + s_ * ((f64)(_const_math__rb6))); r = ((f64)(_const_math__rb0)) + s_ * (((f64)(_const_math__rb1)) + s_ * (((f64)(_const_math__rb2)) + s_ * (((f64)(_const_math__rb3)) + s_ * tmp31))); f64 tmp32 = ((f64)(_const_math__sb4)) + s_ * (((f64)(_const_math__sb5)) + s_ * (((f64)(_const_math__sb6)) + s_ * ((f64)(_const_math__sb7)))); s = ((f64)(1.0)) + s_ * (((f64)(_const_math__sb1)) + s_ * (((f64)(_const_math__sb2)) + s_ * (((f64)(_const_math__sb3)) + s_ * tmp32))); } f64 z = math__f64_from_bits((math__f64_bits(x) & 0xffffffff00000000ULL)); f64 r_ = math__exp(-z * z - ((f64)(0.5625))) * math__exp((z - x) * (z + x) + r / s); if (neg) { return r_ / x - ((f64)(1.0)); } return ((f64)(1.0)) - r_ / x; } f64 math__erfc(f64 a) { f64 x = a; f64 tiny = ((f64)(1.0)) / ((f64)(v__lshift_u64(((u64)(1)), (u64)56))); if (math__is_nan(x)) { return math__nan(); } if (math__is_inf(x, 1)) { return 0.0; } if (math__is_inf(x, -1)) { return 2.0; } bool neg = false; if (x < 0) { x = -x; neg = true; } if (x < ((f64)(0.84375))) { f64 temp = 0.0; if (x < tiny) { temp = x; } else { f64 z = x * x; f64 r = ((f64)(_const_math__pp0)) + z * (((f64)(_const_math__pp1)) + z * (((f64)(_const_math__pp2)) + z * (((f64)(_const_math__pp3)) + z * ((f64)(_const_math__pp4))))); f64 s_ = ((f64)(1.0)) + z * (((f64)(_const_math__qq1)) + z * (((f64)(_const_math__qq2)) + z * (((f64)(_const_math__qq3)) + z * (((f64)(_const_math__qq4)) + z * ((f64)(_const_math__qq5)))))); f64 y = r / s_; if (x < ((f64)(0.25))) { temp = x + x * y; } else { temp = ((f64)(0.5)) + (x * y + (x - ((f64)(0.5)))); } } if (neg) { return ((f64)(1.0)) + temp; } return ((f64)(1.0)) - temp; } if (x < ((f64)(1.25))) { f64 s_ = x - 1; f64 p = ((f64)(_const_math__pa0)) + s_ * (((f64)(_const_math__pa1)) + s_ * (((f64)(_const_math__pa2)) + s_ * (((f64)(_const_math__pa3)) + s_ * (((f64)(_const_math__pa4)) + s_ * (((f64)(_const_math__pa5)) + s_ * ((f64)(_const_math__pa6))))))); f64 q = ((f64)(1.0)) + s_ * (((f64)(_const_math__qa1)) + s_ * (((f64)(_const_math__qa2)) + s_ * (((f64)(_const_math__qa3)) + s_ * (((f64)(_const_math__qa4)) + s_ * (((f64)(_const_math__qa5)) + s_ * ((f64)(_const_math__qa6))))))); if (neg) { return ((f64)(1.8450629115104675)) + p / q; } return ((f64)(0.15493708848953247)) - p / q; } if (x < 28) { f64 s_ = ((f64)(1.0)) / (x * x); f64 r = 0.0; f64 s = 0.0; if (x < ((f64)(2.857142857142857))) { f64 tmp281 = ((f64)(_const_math__ra4)) + s_ * (((f64)(_const_math__ra5)) + s_ * (((f64)(_const_math__ra6)) + s_ * ((f64)(_const_math__ra7)))); r = ((f64)(_const_math__ra0)) + s_ * (((f64)(_const_math__ra1)) + s_ * (((f64)(_const_math__ra2)) + s_ * (((f64)(_const_math__ra3)) + s_ * tmp281))); f64 tmp282 = ((f64)(_const_math__sa4)) + s_ * (((f64)(_const_math__sa5)) + s_ * (((f64)(_const_math__sa6)) + s_ * (((f64)(_const_math__sa7)) + s_ * ((f64)(_const_math__sa8))))); s = ((f64)(1.0)) + s_ * (((f64)(_const_math__sa1)) + s_ * (((f64)(_const_math__sa2)) + s_ * (((f64)(_const_math__sa3)) + s_ * tmp282))); } else { if (neg && x > 6) { return 2.0; } f64 tmp291 = ((f64)(_const_math__rb3)) + s_ * (((f64)(_const_math__rb4)) + s_ * (((f64)(_const_math__rb5)) + s_ * ((f64)(_const_math__rb6)))); r = ((f64)(_const_math__rb0)) + s_ * (((f64)(_const_math__rb1)) + s_ * (((f64)(_const_math__rb2)) + s_ * tmp291)); f64 tmp292 = ((f64)(_const_math__sb3)) + s_ * (((f64)(_const_math__sb4)) + s_ * (((f64)(_const_math__sb5)) + s_ * (((f64)(_const_math__sb6)) + s_ * ((f64)(_const_math__sb7))))); s = ((f64)(1.0)) + s_ * (((f64)(_const_math__sb1)) + s_ * (((f64)(_const_math__sb2)) + s_ * tmp292)); } f64 z = math__f64_from_bits((math__f64_bits(x) & 0xffffffff00000000ULL)); f64 r_ = math__exp(-z * z - ((f64)(0.5625))) * math__exp((z - x) * (z + x) + r / s); if (neg) { return ((f64)(2.0)) - r_ / x; } return r_ / x; } if (neg) { return 2.0; } return 0.0; } inline f64 math__exp(f64 x) { return exp(x); } inline f64 math__exp2(f64 x) { return exp2(x); } inline f64 math__ldexp(f64 frac, int exp) { return ldexp(frac, exp); } f64 math__pure_v_but_overridden_by_c_exp(f64 x) { f64 log2e = 1.44269504088896338700e+00; f64 overflow = 7.09782712893383973096e+02; f64 underflow = -7.45133219101941108420e+02; float_literal near_zero = (float_literal)(1.0 / 268435456); if (math__is_nan(x) || math__is_inf(x, 1)) { return x; } if (math__is_inf(x, -1)) { return 0.0; } if (x > overflow) { return math__inf(1); } if (x < underflow) { return 0.0; } if (-near_zero < x && x < near_zero) { return ((f64)(1.0)) + x; } int k = 0; if (x < 0) { k = ((int)(log2e * x - ((f64)(0.5)))); } if (x > 0) { k = ((int)(log2e * x + ((f64)(0.5)))); } f64 hi = x - ((f64)(k)) * ((f64)(_const_math__ln2hi)); f64 lo = ((f64)(k)) * ((f64)(_const_math__ln2lo)); return math__expmulti(hi, lo, k); } f64 math__pure_v_but_overridden_by_c_exp2(f64 x) { f64 overflow = 1.0239999999999999e+03; f64 underflow = -1.0740e+03; if (math__is_nan(x) || math__is_inf(x, 1)) { return x; } if (math__is_inf(x, -1)) { return 0; } if (x > overflow) { return math__inf(1); } if (x < underflow) { return 0; } int k = 0; if (x > 0) { k = ((int)(x + ((f64)(0.5)))); } if (x < 0) { k = ((int)(x - ((f64)(0.5)))); } f64 t = x - ((f64)(k)); f64 hi = t * ((f64)(_const_math__ln2hi)); f64 lo = -t * ((f64)(_const_math__ln2lo)); return math__expmulti(hi, lo, k); } f64 math__pure_v_but_overridden_by_c_ldexp(f64 frac, int exp) { return math__scalbn(frac, exp); } multi_return_f64_int math__frexp(f64 x) { u64 y = math__f64_bits(x); int ee = ((int)(((v__rshift_u64(y, (u64)52)) & 0x7ff))); if (ee == 0) { if (x != ((f64)(0.0))) { f64 x1p64 = math__f64_from_bits(((u64)(0x43f0000000000000LL))); multi_return_f64_int mr_3373 = math__frexp(x * x1p64); f64 z = mr_3373.arg0; int e_ = mr_3373.arg1; return (multi_return_f64_int){.arg0=z, .arg1=e_ - 64}; } return (multi_return_f64_int){.arg0=x, .arg1=0}; } else if (ee == 0x7ff) { return (multi_return_f64_int){.arg0=x, .arg1=0}; } int e_ = ee - 0x3fe; y &= ((u64)(0x800fffffffffffffULL)); y |= ((u64)(0x3fe0000000000000LL)); return (multi_return_f64_int){.arg0=math__f64_from_bits(y), .arg1=e_}; } f64 math__expm1(f64 x) { if (math__is_inf(x, 1) || math__is_nan(x)) { return x; } if (math__is_inf(x, -1)) { return ((f64)(-1)); } if (math__abs_T_f64(x) < ((f64)(_const_math__ln2))) { f64 i = 1.0; f64 sum = x; f64 term = x / ((f64)(1.0)); i++; term *= x / ((f64)(i)); sum += term; for (;;) { if (!(math__abs_T_f64(term) > math__abs_T_f64(sum) * ((f64)(_const_math__internal__f64_epsilon)))) break; i++; term *= x / ((f64)(i)); sum += term; } return sum; } else { return math__exp(x) - 1; } return 0; } VV_LOC f64 math__expmulti(f64 hi, f64 lo, int k) { f64 exp_p1 = 1.66666666666666657415e-01; f64 exp_p2 = -2.77777777770155933842e-03; f64 exp_p3 = 6.61375632143793436117e-05; f64 exp_p4 = -1.65339022054652515390e-06; f64 exp_p5 = 4.13813679705723846039e-08; f64 r = hi - lo; f64 t = r * r; f64 c = r - t * (exp_p1 + t * (exp_p2 + t * (exp_p3 + t * (exp_p4 + t * exp_p5)))); f64 y = 1 - ((lo - (r * c) / (2 - c)) - hi); return math__ldexp(y, k); } f64 math__factorial(f64 n) { if (n >= _const_math__factorials_table.len) { return _const_math__max_f64; } if (n == ((f64)(((i64)(n)))) && n >= ((f64)(0.0))) { return (*(f64*)builtin__array_get(_const_math__factorials_table, ((int)(n)))); } return math__gamma(n + ((f64)(1.0))); } f64 math__log_factorial(f64 n) { if (n < 0) { return -_const_math__max_f64; } if (n != ((f64)(((i64)(n))))) { return math__log_gamma(n + 1); } else if (n < _const_math__log_factorials_table.len) { return (*(f64*)builtin__array_get(_const_math__log_factorials_table, ((int)(n)))); } return math__log_factorial_asymptotic_expansion(((int)(n))); } VV_LOC f64 math__log_factorial_asymptotic_expansion(int n) { int m = 6; Array_f64 term = builtin____new_array_with_default(0, 0, sizeof(f64), 0); f64 xx = ((f64)((n + 1) * (n + 1))); f64 xj = ((f64)(n + 1)); f64 log_fact = ((f64)(_const_math__log_sqrt_2pi)) - xj + (xj - ((f64)(0.5))) * math__log(xj); int i = 0; for (i = 0; i < m; i++) { builtin__array_push((array*)&term, _MOV((f64[]){ (*(f64*)builtin__array_get(_const_math__bernoulli, i)) / xj })); xj *= xx; } f64 sum = (*(f64*)builtin__array_get(term, m - 1)); for (i = m - 2; i >= 0; i--) { if (math__abs_T_f64(sum) <= math__abs_T_f64((*(f64*)builtin__array_get(term, i)))) { break; } sum = (*(f64*)builtin__array_get(term, i)); } for (;;) { if (!(i >= 0)) break; sum += (*(f64*)builtin__array_get(term, i)); i--; } return log_fact + sum; } i64 math__factoriali(int n) { if (n <= 0) { return ((i64)(1)); } if (n < 21) { return ((i64)((*(f64*)builtin__array_get(_const_math__factorials_table, n)))); } return ((i64)(-1)); } f64 math__floor(f64 x) { if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { return x; } if (x < 0) { multi_return_f64_f64 mr_280 = math__modf(-x); f64 d = mr_280.arg0; f64 fract = mr_280.arg1; if (fract != ((f64)(0.0))) { d = d + 1; } return -d; } multi_return_f64_f64 mr_350 = math__modf(x); f64 d = mr_350.arg0; return d; } f32 math__floorf(f32 x) { return ((f32)(math__floor(((f64)(x))))); } f64 math__ceil(f64 x) { return -math__floor(-x); } f64 math__trunc(f64 x) { if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { return x; } multi_return_f64_f64 mr_1200 = math__modf(x); f64 d = mr_1200.arg0; return d; } f64 math__round(f64 x) { u64 bits = math__f64_bits(x); u64 e_ = ((v__rshift_u64(bits, (u64)52)) & 0x7FF); if (e_ < 1023) { bits &= _const_math__sign_mask; if (e_ == 1022) { bits |= _const_math__uvone; } } else if (e_ < 1075) { u64 half = v__lshift_u64(((u64)(1)), (u64)51); e_ -= _const_math__bias; bits += v__rshift_u64(half, (u64)e_); bits &= ~(v__rshift_u64(_const_math__frac_mask, (u64)e_)); } return math__f64_from_bits(bits); } f64 math__round_sig(f64 x, int sig_digits) { string ret_str = builtin__f64_str(x); switch (sig_digits) { case 0: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8000000d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 1: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8000020d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 2: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8000040d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 3: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8000060d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 4: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8000080d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 5: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x80000a0d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 6: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x80000c0d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 7: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x80000e0d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 8: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8000100d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 9: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8000120d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 10: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8000140d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 11: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8000160d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 12: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8000180d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 13: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x80001a0d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 14: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x80001c0d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 15: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x80001e0d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } case 16: { ret_str = builtin__str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8000200d, {.d_f64 = x}, 0, 0, 0}, {_SLIT0, 0, { .d_c = 0 }, 0, 0, 0}})); break; } default: { { ret_str = builtin__f64_str(x); break; } } } return builtin__string_f64(ret_str); } f64 math__round_to_even(f64 x) { u64 bits = math__f64_bits(x); u64 e_ = ((v__rshift_u64(bits, (u64)52)) & 0x7FF); if (e_ >= 1023) { u64 half_minus_ulp = ((u64)(v__lshift_u64(((u64)(1)), (u64)51))) - 1; e_ -= ((u64)(_const_math__bias)); bits += math__safe_shift(half_minus_ulp + (math__safe_shift(bits, 52 - e_) & 1), e_); bits &= ~math__safe_shift(_const_math__frac_mask, e_); } else if (e_ == 1022 && (bits & _const_math__frac_mask) != 0) { bits = ((bits & _const_math__sign_mask) | _const_math__uvone); } else { bits &= _const_math__sign_mask; } return math__f64_from_bits(bits); } inline VV_LOC u64 math__safe_shift(u64 value, u64 shift) { return (shift > ((u64)(63)) ? (((u64)(0))) : (v__rshift_u64(value, (u64)shift))); } VV_LOC bool math__is_neg_int(f64 x) { if (x < 0) { multi_return_f64_f64 mr_61 = math__modf(x); f64 xf = mr_61.arg1; return xf == 0; } return false; } VV_LOC multi_return_f64_f64 math__stirling(f64 x) { if (x > 200) { return (multi_return_f64_f64){.arg0=math__inf(1), .arg1=1.0}; } f64 w = ((f64)(1.0)) / x; w = ((f64)(1.0)) + w * (((((*(f64*)builtin__array_get(_const_math__gamma_s, 0)) * w + (*(f64*)builtin__array_get(_const_math__gamma_s, 1))) * w + (*(f64*)builtin__array_get(_const_math__gamma_s, 2))) * w + (*(f64*)builtin__array_get(_const_math__gamma_s, 3))) * w + (*(f64*)builtin__array_get(_const_math__gamma_s, 4))); f64 y1 = math__exp(x); f64 y2 = 1.0; if (x > ((f64)(143.01608))) { f64 v = math__pow(x, ((f64)(0.5)) * x - ((f64)(0.25))); f64 y1_ = y1; y1 = v; y2 = v / y1_; } else { y1 = math__pow(x, x - ((f64)(0.5))) / y1; } return (multi_return_f64_f64){.arg0=y1, .arg1=((f64)(2.506628274631000502417)) * w * y2}; } f64 math__gamma(f64 a) { f64 x = a; if (math__is_neg_int(x) || math__is_inf(x, -1) || math__is_nan(x)) { return math__nan(); } if (math__is_inf(x, 1)) { return math__inf(1); } if (x == ((f64)(0.0))) { return math__copysign(math__inf(1), x); } f64 q = math__abs_T_f64(x); f64 p = math__floor(q); if (q > 33) { if (x >= 0) { multi_return_f64_f64 mr_1507 = math__stirling(x); f64 y1 = mr_1507.arg0; f64 y2 = mr_1507.arg1; return y1 * y2; } int signgam = 1; i64 ip = ((i64)(p)); if (((ip & 1)) == 0) { signgam = -1; } f64 z = q - p; if (z > ((f64)(0.5))) { p = p + 1; z = q - p; } z = q * math__sin(((f64)(_const_math__pi)) * z); if (z == 0) { return math__inf(signgam); } multi_return_f64_f64 mr_1952 = math__stirling(q); f64 sq1 = mr_1952.arg0; f64 sq2 = mr_1952.arg1; f64 absz = math__abs_T_f64(z); f64 d = absz * sq1 * sq2; if (math__is_inf(d, 0)) { z = ((f64)(_const_math__pi)) / absz / sq1 / sq2; } else { z = ((f64)(_const_math__pi)) / d; } return ((f64)(signgam)) * z; } f64 z = 1.0; for (;;) { if (!(x >= 3)) break; x = x - 1; z = z * x; } for (;;) { if (!(x < 0)) break; if (x > ((f64)(-1e-09))) { return math__gamma_too_small(x, z); } z = z / x; x = x + 1; } for (;;) { if (!(x < 2)) break; if (x < ((f64)(1e-09))) { return math__gamma_too_small(x, z); } z = z / x; x = x + 1; } if (x == 2) { return z; } x = x - 2; p = (((((x * (*(f64*)builtin__array_get(_const_math__gamma_p, 0)) + (*(f64*)builtin__array_get(_const_math__gamma_p, 1))) * x + (*(f64*)builtin__array_get(_const_math__gamma_p, 2))) * x + (*(f64*)builtin__array_get(_const_math__gamma_p, 3))) * x + (*(f64*)builtin__array_get(_const_math__gamma_p, 4))) * x + (*(f64*)builtin__array_get(_const_math__gamma_p, 5))) * x + (*(f64*)builtin__array_get(_const_math__gamma_p, 6)); q = ((((((x * (*(f64*)builtin__array_get(_const_math__gamma_q, 0)) + (*(f64*)builtin__array_get(_const_math__gamma_q, 1))) * x + (*(f64*)builtin__array_get(_const_math__gamma_q, 2))) * x + (*(f64*)builtin__array_get(_const_math__gamma_q, 3))) * x + (*(f64*)builtin__array_get(_const_math__gamma_q, 4))) * x + (*(f64*)builtin__array_get(_const_math__gamma_q, 5))) * x + (*(f64*)builtin__array_get(_const_math__gamma_q, 6))) * x + (*(f64*)builtin__array_get(_const_math__gamma_q, 7)); return z * p / q; } VV_LOC f64 math__gamma_too_small(f64 x, f64 z) { if (x == 0) { return math__inf(1); } f64 euler = 0.57721566490153286060651209008240243104215933593992; return z / ((((f64)(1.0)) + euler * x) * x); } f64 math__log_gamma(f64 x) { multi_return_f64_int mr_3163 = math__log_gamma_sign(x); f64 y = mr_3163.arg0; return y; } multi_return_f64_int math__log_gamma_sign(f64 a) { f64 x = a; int sgn = 1; if (math__is_nan(x)) { return (multi_return_f64_int){.arg0=x, .arg1=sgn}; } if (math__is_inf(x, 1)) { return (multi_return_f64_int){.arg0=x, .arg1=sgn}; } if (x == ((f64)(0.0))) { return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sgn}; } bool neg = false; if (x < 0) { x = -x; neg = true; } if (x < math__exp2(-70)) { if (neg) { sgn = -1; } return (multi_return_f64_int){.arg0=-math__log(x), .arg1=sgn}; } f64 nadj = 0.0; if (neg) { if (x >= math__exp2(52)) { return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sgn}; } f64 t = math__sin_pi(x); if (t == 0) { return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sgn}; } nadj = math__log(((f64)(_const_math__pi)) / math__abs_T_f64(t * x)); if (t < 0) { sgn = -1; } } f64 lgamma = 0.0; if (x == 1 || x == 2) { return (multi_return_f64_int){.arg0=0.0, .arg1=sgn}; } else if (x < 2) { f64 ymin = 1.461632144968362245; f64 tc = 1.46163214496836224576e+00; f64 y = 0.0; int i = 0; if (x <= ((f64)(0.9))) { lgamma = -math__log(x); if (x >= (ymin - 1 + ((f64)(0.27)))) { y = ((f64)(1.0)) - x; i = 0; } else if (x >= (ymin - 1 - ((f64)(0.27)))) { y = x - (tc - 1); i = 1; } else { y = x; i = 2; } } else { lgamma = 0; if (x >= (ymin + ((f64)(0.27)))) { y = ((f64)(2)) - x; i = 0; } else if (x >= (ymin - ((f64)(0.27)))) { y = x - tc; i = 1; } else { y = x - 1; i = 2; } } if (i == 0) { f64 z = y * y; f64 gamma_p1 = (*(f64*)builtin__array_get(_const_math__lgamma_a, 0)) + z * ((*(f64*)builtin__array_get(_const_math__lgamma_a, 2)) + z * ((*(f64*)builtin__array_get(_const_math__lgamma_a, 4)) + z * ((*(f64*)builtin__array_get(_const_math__lgamma_a, 6)) + z * ((*(f64*)builtin__array_get(_const_math__lgamma_a, 8)) + z * (*(f64*)builtin__array_get(_const_math__lgamma_a, 10)))))); f64 gamma_p2 = z * ((*(f64*)builtin__array_get(_const_math__lgamma_a, 1)) + z * ((*(f64*)builtin__array_get(_const_math__lgamma_a, 3)) + z * ((*(f64*)builtin__array_get(_const_math__lgamma_a, 5)) + z * ((*(f64*)builtin__array_get(_const_math__lgamma_a, 7)) + z * ((*(f64*)builtin__array_get(_const_math__lgamma_a, 9)) + z * (*(f64*)builtin__array_get(_const_math__lgamma_a, 11))))))); f64 p = y * gamma_p1 + gamma_p2; lgamma += (p - ((f64)(0.5)) * y); } else if (i == 1) { f64 z = y * y; f64 w = z * y; f64 gamma_p1 = (*(f64*)builtin__array_get(_const_math__lgamma_t, 0)) + w * ((*(f64*)builtin__array_get(_const_math__lgamma_t, 3)) + w * ((*(f64*)builtin__array_get(_const_math__lgamma_t, 6)) + w * ((*(f64*)builtin__array_get(_const_math__lgamma_t, 9)) + w * (*(f64*)builtin__array_get(_const_math__lgamma_t, 12))))); f64 gamma_p2 = (*(f64*)builtin__array_get(_const_math__lgamma_t, 1)) + w * ((*(f64*)builtin__array_get(_const_math__lgamma_t, 4)) + w * ((*(f64*)builtin__array_get(_const_math__lgamma_t, 7)) + w * ((*(f64*)builtin__array_get(_const_math__lgamma_t, 10)) + w * (*(f64*)builtin__array_get(_const_math__lgamma_t, 13))))); f64 gamma_p3 = (*(f64*)builtin__array_get(_const_math__lgamma_t, 2)) + w * ((*(f64*)builtin__array_get(_const_math__lgamma_t, 5)) + w * ((*(f64*)builtin__array_get(_const_math__lgamma_t, 8)) + w * ((*(f64*)builtin__array_get(_const_math__lgamma_t, 11)) + w * (*(f64*)builtin__array_get(_const_math__lgamma_t, 14))))); f64 tf = -1.21486290535849611461e-01; f64 tt = -3.63867699703950536541e-18; f64 p = z * gamma_p1 - (tt - w * (gamma_p2 + y * gamma_p3)); lgamma += (tf + p); } else if (i == 2) { f64 gamma_p1 = y * ((*(f64*)builtin__array_get(_const_math__lgamma_u, 0)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_u, 1)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_u, 2)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_u, 3)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_u, 4)) + y * (*(f64*)builtin__array_get(_const_math__lgamma_u, 5))))))); f64 gamma_p2 = ((f64)(1.0)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_v, 1)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_v, 2)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_v, 3)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_v, 4)) + y * (*(f64*)builtin__array_get(_const_math__lgamma_v, 5)))))); lgamma += (((f64)(-0.5)) * y + gamma_p1 / gamma_p2); } } else if (x < 8) { int i = ((int)(x)); f64 y = x - ((f64)(i)); f64 tmp23456 = (*(f64*)builtin__array_get(_const_math__lgamma_s, 2)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_s, 3)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_s, 4)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_s, 5)) + y * (*(f64*)builtin__array_get(_const_math__lgamma_s, 6))))); f64 p = y * ((*(f64*)builtin__array_get(_const_math__lgamma_s, 0)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_s, 1)) + y * tmp23456)); f64 tmpr23456 = (*(f64*)builtin__array_get(_const_math__lgamma_r, 2)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_r, 3)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_r, 4)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_r, 5)) + y * (*(f64*)builtin__array_get(_const_math__lgamma_r, 6))))); f64 q = ((f64)(1.0)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_r, 1)) + y * tmpr23456); lgamma = ((f64)(0.5)) * y + p / q; f64 z = 1.0; if (i == 7) { z *= (y + 6); z *= (y + 5); z *= (y + 4); z *= (y + 3); z *= (y + 2); lgamma += math__log(z); } else if (i == 6) { z *= (y + 5); z *= (y + 4); z *= (y + 3); z *= (y + 2); lgamma += math__log(z); } else if (i == 5) { z *= (y + 4); z *= (y + 3); z *= (y + 2); lgamma += math__log(z); } else if (i == 4) { z *= (y + 3); z *= (y + 2); lgamma += math__log(z); } else if (i == 3) { z *= (y + 2); lgamma += math__log(z); } } else if (x < math__exp2(58)) { f64 t = math__log(x); f64 z = ((f64)(1.0)) / x; f64 y = z * z; f64 w = (*(f64*)builtin__array_get(_const_math__lgamma_w, 0)) + z * ((*(f64*)builtin__array_get(_const_math__lgamma_w, 1)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_w, 2)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_w, 3)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_w, 4)) + y * ((*(f64*)builtin__array_get(_const_math__lgamma_w, 5)) + y * (*(f64*)builtin__array_get(_const_math__lgamma_w, 6))))))); lgamma = (x - ((f64)(0.5))) * (t - ((f64)(1.0))) + w; } else { lgamma = x * (math__log(x) - ((f64)(1.0))); } if (neg) { lgamma = nadj - lgamma; } return (multi_return_f64_int){.arg0=lgamma, .arg1=sgn}; } VV_LOC f64 math__sin_pi(f64 x_) { f64 x = x_; if (x < ((f64)(0.25))) { return -math__sin(((f64)(_const_math__pi)) * x); } f64 z = math__floor(x); int n = 0; if (z != x) { x = math__mod(x, 2); n = ((int)(x * 4)); } else { if (x >= math__exp2(53)) { x = 0; n = 0; } else { f64 two52 = math__exp2(52); if (x < two52) { z = x + two52; } n = (1 & ((int)(math__f64_bits(z)))); x = ((f64)(n)); n = v__lshift_int(n, (u64)2); } } if (n == 0) { x = math__sin(((f64)(_const_math__pi)) * x); } else if (n == 1 || n == 2) { x = math__cos(((f64)(_const_math__pi)) * (((f64)(0.5)) - x)); } else if (n == 3 || n == 4) { x = math__sin(((f64)(_const_math__pi)) * (((f64)(1.0)) - x)); } else if (n == 5 || n == 6) { x = -math__cos(((f64)(_const_math__pi)) * (x - ((f64)(1.5)))); } else { x = math__sin(((f64)(_const_math__pi)) * (x - 2)); } return -x; } f64 math__hypot(f64 x, f64 y) { f64 p = math__abs_T_f64(x); f64 q = math__abs_T_f64(y); if (math__is_inf(p, 1) || math__is_inf(q, 1)) { return math__inf(1); } if (math__is_nan(p) || math__is_nan(q)) { return math__nan(); } if (p < q) { f64 _var_382 = p; f64 _var_385 = q; p = _var_385; q = _var_382; } if (p == ((f64)(0.0))) { return 0.0; } q = q / p; return p * math__sqrt(1 + q * q); } inline math__BezierPoint math__cubic_bezier(f64 t, Array_math__BezierPoint p) { if (p.len != 4) { builtin___v_panic(_S("invalid p.len")); VUNREACHABLE(); } return math__cubic_bezier_coords(t, ((math__BezierPoint*)p.data)[0].x, ((math__BezierPoint*)p.data)[1].x, ((math__BezierPoint*)p.data)[2].x, ((math__BezierPoint*)p.data)[3].x, ((math__BezierPoint*)p.data)[0].y, ((math__BezierPoint*)p.data)[1].y, ((math__BezierPoint*)p.data)[2].y, ((math__BezierPoint*)p.data)[3].y); } inline math__BezierPoint math__cubic_bezier_a(f64 t, Array_f64 x, Array_f64 y) { if (x.len != 4) { builtin___v_panic(_S("invalid x.len")); VUNREACHABLE(); } if (y.len != 4) { builtin___v_panic(_S("invalid y.len")); VUNREACHABLE(); } return math__cubic_bezier_coords(t, ((f64*)x.data)[0], ((f64*)x.data)[1], ((f64*)x.data)[2], ((f64*)x.data)[3], ((f64*)y.data)[0], ((f64*)y.data)[1], ((f64*)y.data)[2], ((f64*)y.data)[3]); } inline math__BezierPoint math__cubic_bezier_fa(f64 t, Array_fixed_f64_4 x, Array_fixed_f64_4 y) { return math__cubic_bezier_coords(t, x[0], x[1], x[2], x[3], y[0], y[1], y[2], y[3]); } inline math__BezierPoint math__cubic_bezier_coords(f64 t, f64 x0, f64 x1, f64 x2, f64 x3, f64 y0, f64 y1, f64 y2, f64 y3) { f64 p0 = math__pow(1 - t, 3); f64 p1 = 3 * t * math__pow(1 - t, 2); f64 p2 = 3 * (1 - t) * math__pow(t, 2); f64 p3 = math__pow(t, 3); f64 xt = p0 * x0 + p1 * x1 + p2 * x2 + p3 * x3; f64 yt = p0 * y0 + p1 * y1 + p2 * y2 + p3 * y3; return ((math__BezierPoint){.x = xt,.y = yt,}); } f64 math__acosh(f64 x) { if (x > ((f64)(6.7108864e+07))) { return math__log(x) + ((f64)(_const_math__ln2)); } else if (x > ((f64)(2.0))) { return math__log(((f64)(2.0)) * x - ((f64)(1.0)) / (math__sqrt(x * x - ((f64)(1.0))) + x)); } else if (x > ((f64)(1.0))) { f64 t = x - ((f64)(1.0)); return math__log1p(t + math__sqrt(((f64)(2.0)) * t + t * t)); } else if (x == ((f64)(1.0))) { return 0.0; } else { return math__nan(); } return 0; } f64 math__asinh(f64 x) { f64 a = math__abs_T_f64(x); f64 s = (x < 0 ? (-1.0) : (1.0)); if (a > ((f64)(6.7108864e+07))) { return s * (math__log(a) + ((f64)(_const_math__ln2))); } else if (a > ((f64)(2.0))) { return s * math__log(((f64)(2.0)) * a + ((f64)(1.0)) / (a + math__sqrt(a * a + ((f64)(1.0))))); } else if (a > ((f64)(_const_math__internal__sqrt_f64_epsilon))) { f64 a2 = a * a; return s * math__log1p(a + a2 / (((f64)(1.0)) + math__sqrt(((f64)(1.0)) + a2))); } else { return x; } return 0; } f64 math__atanh(f64 x) { f64 a = math__abs_T_f64(x); f64 s = (x < 0 ? (-1.0) : (1.0)); if (a > ((f64)(1.0))) { return math__nan(); } else if (a == ((f64)(1.0))) { return (x < 0 ? (math__inf(-1)) : (math__inf(1))); } else if (a >= ((f64)(0.5))) { return s * ((f64)(0.5)) * math__log1p(((f64)(2.0)) * a / (((f64)(1.0)) - a)); } else if (a > ((f64)(_const_math__internal__f64_epsilon))) { return s * ((f64)(0.5)) * math__log1p(((f64)(2.0)) * a + ((f64)(2.0)) * a * a / (((f64)(1.0)) - a)); } else { return x; } return 0; } inline VV_LOC f64 math__xatan(f64 x) { f64 xatan_p0 = -8.750608600031904122785e-01; f64 xatan_p1 = -1.615753718733365076637e+01; f64 xatan_p2 = -7.500855792314704667340e+01; f64 xatan_p3 = -1.228866684490136173410e+02; f64 xatan_p4 = -6.485021904942025371773e+01; f64 xatan_q0 = 2.485846490142306297962e+01; f64 xatan_q1 = 1.650270098316988542046e+02; f64 xatan_q2 = 4.328810604912902668951e+02; f64 xatan_q3 = 4.853903996359136964868e+02; f64 xatan_q4 = 1.945506571482613964425e+02; f64 z = x * x; z = z * ((((xatan_p0 * z + xatan_p1) * z + xatan_p2) * z + xatan_p3) * z + xatan_p4) / (((((z + xatan_q0) * z + xatan_q1) * z + xatan_q2) * z + xatan_q3) * z + xatan_q4); z = x * z + x; return z; } inline VV_LOC f64 math__satan(f64 x) { if (x <= ((f64)(0.66))) { return math__xatan(x); } if (x > ((f64)(_const_math__tan3pio8))) { return ((f64)(1.5707963267948966)) - math__xatan(((f64)(1.0)) / x) + ((f64)(_const_math__morebits)); } return ((f64)((float_literal)(3.14159265358979323846264338327950288419716939937510582097494459 / 4))) + math__xatan((x - ((f64)(1.0))) / (x + ((f64)(1.0)))) + ((f64)(0.5)) * ((f64)(_const_math__morebits)); } f64 math__atan(f64 x) { if (x == 0) { return x; } if (x > 0) { return math__satan(x); } return -math__satan(-x); } f64 math__atan2(f64 y, f64 x) { if (math__is_nan(y) || math__is_nan(x)) { return math__nan(); } if (y == ((f64)(0.0))) { if (x >= 0 && !math__signbit(x)) { return math__copysign(0, y); } return math__copysign(_const_math__pi, y); } if (x == ((f64)(0.0))) { return math__copysign(1.5707963267948966, y); } if (math__is_inf(x, 0)) { if (math__is_inf(x, 1)) { if (math__is_inf(y, 0)) { return math__copysign((float_literal)(3.14159265358979323846264338327950288419716939937510582097494459 / 4), y); } return math__copysign(0, y); } if (math__is_inf(y, 0)) { return math__copysign(2.356194490192345, y); } return math__copysign(_const_math__pi, y); } if (math__is_inf(y, 0)) { return math__copysign(1.5707963267948966, y); } f64 q = math__atan(y / x); if (x < 0) { if (q <= 0) { return q + ((f64)(_const_math__pi)); } return q - ((f64)(_const_math__pi)); } return q; } f64 math__asin(f64 x_) { f64 x = x_; if (x == ((f64)(0.0))) { return x; } bool neg = false; if (x < ((f64)(0.0))) { x = -x; neg = true; } if (x > ((f64)(1.0))) { return math__nan(); } f64 temp = math__sqrt(((f64)(1.0)) - x * x); if (x > ((f64)(0.7))) { temp = ((f64)(1.5707963267948966)) - math__satan(temp / x); } else { temp = math__satan(x / temp); } if (neg) { temp = -temp; } return temp; } inline f64 math__acos(f64 x) { if (x < ((f64)(-1.0)) || x > ((f64)(1.0))) { return math__nan(); } if (x > ((f64)(0.5))) { return ((f64)(2.0)) * math__asin(math__sqrt(((f64)(0.5)) - ((f64)(0.5)) * x)); } f64 z = ((f64)(_const_math__pi)) / ((f64)(4.0)) - math__asin(x); z = z + ((f64)(_const_math__morebits)); z = z + ((f64)(_const_math__pi)) / ((f64)(4.0)); return z; } inline f64 math__log(f64 x) { return log(x); } inline f64 math__log2(f64 x) { return log2(x); } inline f64 math__log10(f64 x) { return log10(x); } inline f64 math__log1p(f64 x) { return log1p(x); } f64 math__log_b(f64 x) { return logb(x); } inline f32 math__logf(f32 x) { return logf(x); } f64 math__log_n(f64 x, f64 b) { f64 y = math__log(x); f64 z = math__log(b); return y / z; } f64 math__pure_v_but_overridden_by_c_log10(f64 x) { f64 x_ = x; i64 hx = ((i64)(math__f64_bits(x_))); i32 k = ((i32)(0)); if (hx < ((i64)(0x0010000000000000LL))) { if ((hx & 0x7fffffffffffffffLL) == 0) { return math__inf(-1); } if (hx < 0) { return (x_ - x_) / (x_ - x_); } k = k - 54; x_ *= _const_math__two54; hx = ((i64)(math__f64_bits(x_))); } if (_us64_le(((u64)(0x7ff0000000000000LL)),hx)) { return x_ + x_; } k = k + ((i32)((((u64)((v__rshift_i64(hx, (u64)52)) - 1023))))); i32 i = ((i32)(v__rshift_u64(((((u64)(k)) & 0x8000000000000000ULL)), (u64)63))); hx = (((hx & 0x000fffffffffffffLL)) | (v__lshift_u64(((u64)(0x3ff - i)), (u64)52))); f64 y = ((f64)(k + i)); x_ = math__f64_from_bits(((u64)(hx))); f64 z = y * _const_math__log10_2lo + _const_math__ivln10 * math__log(x_); return z + y * _const_math__log10_2hi; } f64 math__pure_v_but_overridden_by_c_log2(f64 x) { multi_return_f64_int mr_1442 = math__frexp(x); f64 frac = mr_1442.arg0; int expn = mr_1442.arg1; if (frac == ((f64)(0.5))) { return ((f64)(expn - 1)); } return math__log(frac) * ((f64)(1.4426950408889634)) + ((f64)(expn)); } f64 math__pure_v_but_overridden_by_c_log1p(f64 x) { f64 y = ((f64)(1.0)) + x; f64 z = y - ((f64)(1.0)); return math__log(y) - (z - x) / y; } f64 math__pure_v_but_overridden_by_c_log_b(f64 x) { if (x == 0) { return math__inf(-1); } if (math__is_inf(x, 0)) { return math__inf(1); } if (math__is_nan(x)) { return x; } return ((f64)(math__ilog_b_(x))); } int math__ilog_b(f64 x) { if (x == 0) { return ((int)(_const_min_i32)); } if (math__is_nan(x)) { return ((int)(_const_max_i32)); } if (math__is_inf(x, 0)) { return ((int)(_const_max_i32)); } return math__ilog_b_(x); } VV_LOC int math__ilog_b_(f64 x_) { multi_return_f64_int mr_2548 = math__normalize(x_); f64 x = mr_2548.arg0; int expn = mr_2548.arg1; return ((int)(((v__rshift_u64(math__f64_bits(x), (u64)52)) & 0x7FF))) - 1023 + expn; } f64 math__pure_v_but_overridden_by_c_log(f64 a) { f64 ln2_hi = 6.93147180369123816490e-01; f64 ln2_lo = 1.90821492927058770002e-10; f64 l1 = 6.666666666666735130e-01; f64 l2 = 3.999999999940941908e-01; f64 l3 = 2.857142874366239149e-01; f64 l4 = 2.222219843214978396e-01; f64 l5 = 1.818357216161805012e-01; f64 l6 = 1.531383769920937332e-01; f64 l7 = 1.479819860511658591e-01; f64 x = a; if (math__is_nan(x) || math__is_inf(x, 1)) { return x; } else if (x < 0) { return math__nan(); } else if (x == 0) { return math__inf(-1); } multi_return_f64_int mr_5139 = math__frexp(x); f64 f1 = mr_5139.arg0; int ki = mr_5139.arg1; if (f1 < ((f64)((float_literal)(1.41421356237309504880168872420969807856967187537694807317667974 / 2)))) { f1 *= 2; ki--; } f64 f = f1 - 1; f64 k = ((f64)(ki)); f64 s = f / (2 + f); f64 s2 = s * s; f64 s4 = s2 * s2; f64 t1 = s2 * (l1 + s4 * (l3 + s4 * (l5 + s4 * l7))); f64 t2 = s4 * (l2 + s4 * (l4 + s4 * l6)); f64 r = t1 + t2; f64 hfsq = ((f64)(0.5)) * f * f; return k * ln2_hi - ((hfsq - (s * (hfsq + r) + k * ln2_lo)) - f); } #if 0 #else #endif f64 math__aprox_sin(f64 a) { f64 a0 = 1.91059300966915117e-31; f64 a1 = 1.00086760103908896; f64 a2 = -1.21276126894734565e-2; f64 a3 = -1.38078780785773762e-1; f64 a4 = -2.67353392911981221e-2; f64 a5 = 2.08026600266304389e-2; f64 a6 = -3.03996055049204407e-3; f64 a7 = 1.38235642404333740e-4; f64 tmp = a4 + a * (a5 + a * (a6 + a * a7)); return a0 + a * (a1 + a * (a2 + a * (a3 + a * tmp))); } f64 math__aprox_cos(f64 a) { f64 a0 = 9.9995999154986614e-1; f64 a1 = 1.2548995793001028e-3; f64 a2 = -5.0648546280678015e-1; f64 a3 = 1.2942246466519995e-2; f64 a4 = 2.8668384702547972e-2; f64 a5 = 7.3726485210586547e-3; f64 a6 = -3.8510875386947414e-3; f64 a7 = 4.7196604604366623e-4; f64 a8 = -1.8776444013090451e-5; f64 tmp = a4 + a * (a5 + a * (a6 + a * (a7 + a * a8))); return a0 + a * (a1 + a * (a2 + a * (a3 + a * tmp))); } inline f64 math__copysign(f64 x, f64 y) { return math__f64_from_bits((((math__f64_bits(x) & ~_const_math__sign_mask)) | ((math__f64_bits(y) & _const_math__sign_mask)))); } inline f64 math__degrees(f64 radians) { return radians * ((f64)(57.29577951308232)); } inline f64 math__radians(f64 degrees) { return degrees * ((f64)(0.017453292519943295)); } inline f64 math__angle_diff(f64 radian_a, f64 radian_b) { f64 delta = math__fmod(radian_b - radian_a, _const_math__tau); delta = math__fmod(delta + ((f64)(9.42477796076938)), _const_math__tau); delta -= 3.141592653589793; return delta; } Array_int math__digits(i64 num, math__DigitParams params) { int b = params.base; if (b < 2) { builtin__panic_n(_S("digits: Cannot find digits of n with base:"), b); VUNREACHABLE(); } i64 n = num; int sgn = 1; if (n < 0) { sgn = -1; n = -n; } Array_int res = builtin____new_array_with_default(0, 0, sizeof(int), 0); if (n == 0) { builtin__array_push((array*)&res, _MOV((int[]){ 0 })); return res; } for (;;) { if (!(n != 0)) break; i64 next_n = (i64)(VSAFE_DIV_i64(n , b)); builtin__array_push((array*)&res, _MOV((int[]){ ((int)(n - (i64)(next_n * b))) })); n = next_n; } if (sgn == -1) { (*(int*)builtin__array_get(res, res.len - 1)) *= sgn; } if (params.reverse) { res = builtin__array_reverse(res); } return res; } int math__count_digits(i64 number) { i64 n = number; if (n == 0) { return 1; } int c = 0; for (;;) { if (!(n != 0)) break; n = VSAFE_DIV_i64(n , 10); c++; } return c; } multi_return_f64_f64 math__minmax(f64 a, f64 b) { if (a < b) { return (multi_return_f64_f64){.arg0=a, .arg1=b}; } return (multi_return_f64_f64){.arg0=b, .arg1=a}; } inline f64 math__clamp(f64 x, f64 a, f64 b) { if (x < a) { return a; } if (x > b) { return b; } return x; } inline f64 math__sign(f64 n) { if (math__is_nan(n)) { return math__nan(); } return math__copysign(1.0, n); } inline int math__signi(f64 n) { return ((int)(math__copysign(1.0, n))); } inline bool math__signbit(f64 x) { return (math__f64_bits(x) & _const_math__sign_mask) != 0; } bool math__tolerance(f64 actual, f64 expected, f64 tol) { if (actual == expected) { return true; } f64 d = actual - expected; if (d < 0) { d = -d; } f64 ee = tol; if (expected != 0) { ee *= expected; if (ee < 0) { ee = -ee; } } return d < ee; } bool math__close(f64 actual, f64 expected) { return math__tolerance(actual, expected, 1e-14); } bool math__veryclose(f64 actual, f64 expected) { return math__tolerance(actual, expected, 4e-16); } bool math__alike(f64 a, f64 b) { if ((math__f64_bits(a) & 0xFFFFFFFFFFFFFFFCULL) == (math__f64_bits(b) & 0xFFFFFFFFFFFFFFFCULL)) { return true; } if (a == -0LL && b == 0) { return true; } if (a == 0 && b == -0LL) { return true; } if (math__is_nan(a) && math__is_nan(b)) { return true; } if (a == b) { return math__signbit(a) == math__signbit(b); } return false; } multi_return_f64_f64 math__modf(f64 f) { f64 abs_f = math__abs_T_f64(f); f64 i = 0.0; if (abs_f >= ((f64)(_const_math__modf_maxpowtwo))) { i = f; } else { i = abs_f + ((f64)(_const_math__modf_maxpowtwo)); i -= _const_math__modf_maxpowtwo; for (;;) { if (!(i > abs_f)) break; i -= 1.0; } if (f < ((f64)(0.0))) { i = -i; } } return (multi_return_f64_f64){.arg0=i, .arg1=f - i}; } f32 math__nextafter32(f32 x, f32 y) { f32 r = ((f32)(0.0)); if (math__is_nan(((f64)(x))) || math__is_nan(((f64)(y)))) { r = ((f32)(math__nan())); } else if (x == y) { r = x; } else if (x == 0) { r = ((f32)(math__copysign(((f64)(math__f32_from_bits(1))), ((f64)(y))))); } else if ((y > x) == (x > 0)) { r = math__f32_from_bits(math__f32_bits(x) + 1); } else { r = math__f32_from_bits(math__f32_bits(x) - 1); } return r; } f64 math__nextafter(f64 x, f64 y) { f64 r = 0.0; if (math__is_nan(x) || math__is_nan(y)) { r = math__nan(); } else if (x == y) { r = x; } else if (x == 0) { r = math__copysign(math__f64_from_bits(1), y); } else if ((y > x) == (x > 0)) { r = math__f64_from_bits(math__f64_bits(x) + 1); } else { r = math__f64_from_bits(math__f64_bits(x) - 1); } return r; } VV_LOC multi_return_f64_f64 math__ChebSeries_eval_e(math__ChebSeries cs, f64 x) { f64 d = 0.0; f64 dd = 0.0; f64 y = (((f64)(2.0)) * x - cs.a - cs.b) / (cs.b - cs.a); f64 y2 = ((f64)(2.0)) * y; f64 e_ = 0.0; f64 temp = 0.0; for (int j = cs.order; j >= 1; j--) { temp = d; d = y2 * d - dd + (*(f64*)builtin__array_get(cs.c, j)); e_ += math__abs_T_f64(y2 * temp) + math__abs_T_f64(dd) + math__abs_T_f64((*(f64*)builtin__array_get(cs.c, j))); dd = temp; } temp = d; d = y * d - dd + ((f64)(0.5)) * (*(f64*)builtin__array_get(cs.c, 0)); e_ += math__abs_T_f64(y * temp) + math__abs_T_f64(dd) + ((f64)(0.5)) * math__abs_T_f64((*(f64*)builtin__array_get(cs.c, 0))); return (multi_return_f64_f64){.arg0=d, .arg1=((f64)(_const_math__internal__f64_epsilon)) * e_ + math__abs_T_f64((*(f64*)builtin__array_get(cs.c, cs.order)))}; } inline f64 math__pow(f64 x, f64 y) { return pow(x, y); } inline f32 math__powf(f32 a, f32 b) { return powf(a, b); } inline f32 math__pure_v_but_overridden_by_c_powf(f32 a, f32 b) { return ((f32)(math__pow(a, b))); } f64 math__pow10(int n) { if (0 <= n && n <= 308) { return (*(f64*)builtin__array_get(_const_math__pow10postab32, VSAFE_DIV_u32(((u32)(n)) , 32))) * (*(f64*)builtin__array_get(_const_math__pow10tab, VSAFE_MOD_u32(((u32)(n)) , 32))); } if (-323 <= n && n <= 0) { return (*(f64*)builtin__array_get(_const_math__pow10negtab32, VSAFE_DIV_u32(((u32)(-n)) , 32))) / (*(f64*)builtin__array_get(_const_math__pow10tab, VSAFE_MOD_u32(((u32)(-n)) , 32))); } if (n > 0) { return math__inf(1); } return 0.0; } i64 math__powi(i64 a, i64 b) { i64 b_ = b; i64 p = a; i64 v = ((i64)(1)); if (b_ < 0) { if (a == 0) { return -1; } return (a * a != 1 ? (0) : ((((b_ & 1)) > 0 ? (a) : (1)))); } for (; b_ > 0; ) { if ((b_ & 1) > 0) { v *= p; } p *= p; b_ = v__rshift_i64(b_, (u64)1); } return v; } VV_LOC bool math__is_odd_int(f64 x) { multi_return_f64_f64 mr_1555 = math__modf(x); f64 xi = mr_1555.arg0; f64 xf = mr_1555.arg1; return xf == 0 && ((((i64)(xi)) & 1)) == 1; } f64 math__pure_v_but_overridden_by_c_pow(f64 x, f64 y) { if (y == 0 || x == 1) { return 1; } else if (y == 1) { return x; } else if (math__is_nan(x) || math__is_nan(y)) { return math__nan(); } else if (y == 2) { return x * x; } else if (y == 3) { return x * x * x; } else if (x == 0) { if (y < 0) { if (math__is_odd_int(y)) { return math__copysign(math__inf(1), x); } return math__inf(1); } else if (y > 0) { if (math__is_odd_int(y)) { return x; } return 0; } } else if (math__is_inf(y, 0)) { if (x == -1) { return 1; } else if ((math__abs_T_f64(x) < 1) == math__is_inf(y, 1)) { return 0; } else { return math__inf(1); } } else if (math__is_inf(x, 0)) { if (math__is_inf(x, -1)) { return math__pow(1 / x, -y); } if (y < 0) { return 0; } else if (y > 0) { return math__inf(1); } } else if (y == ((f64)(0.5))) { return math__sqrt(x); } else if (y == ((f64)(-0.5))) { return 1 / math__sqrt(x); } multi_return_f64_f64 mr_2579 = math__modf(math__abs_T_f64(y)); f64 yi = mr_2579.arg0; f64 yf = mr_2579.arg1; if (yf != 0 && x < 0) { return math__nan(); } if (yi >= (v__lshift_u64(((u64)(1)), (u64)63))) { if (x == -1) { return 1; } else if ((math__abs_T_f64(x) < 1) == (y > 0)) { return 0; } else { return math__inf(1); } } if (yf == ((f64)(0.0))) { f64 result = x; for (i64 _t22 = 1; _t22 < ((i64)(yi)); ++_t22) { result *= x; } if (y > 0) { return result; } return 1 / result; } f64 a1 = 1.0; int ae = 0; if (yf != 0) { if (yf > ((f64)(0.5))) { yf--; yi++; } a1 = math__exp(yf * math__log(x)); } multi_return_f64_int mr_3354 = math__frexp(x); f64 x1 = mr_3354.arg0; int xe = mr_3354.arg1; for (i64 i = ((i64)(yi)); i != 0; i = v__rshift_i64(i, (u64)1)) { if (xe < ((int)(((u32)(v__lshift_u32(((u32)(-1)), (u64)12))))) || 4096 < xe) { ae += xe; break; } if ((i & 1) == 1) { a1 *= x1; ae += xe; } x1 *= x1; xe = v__lshift_int(xe, (u64)1); if (x1 < ((f64)(.5))) { x1 += x1; xe--; } } if (y < 0) { a1 = 1 / a1; ae = -ae; } return math__ldexp(a1, ae); } inline f64 math__q_rsqrt(f64 x) { f64 x_half = ((f64)(0.5)) * x; i64 i = ((i64)(math__f64_bits(x))); i = 0x5fe6eb50c7b537a9LL - (v__rshift_i64(i, (u64)1)); f64 j = math__f64_from_bits(((u64)(i))); j *= (((f64)(1.5)) - x_half * j * j); j *= (((f64)(1.5)) - x_half * j * j); return j; } f64 math__scalbn(f64 x, int n_) { int n = n_; f64 x1p1023 = math__f64_from_bits(((u64)(0x7fe0000000000000LL))); f64 x1p53 = math__f64_from_bits(((u64)(0x4340000000000000LL))); f64 x1p_1022 = math__f64_from_bits(((u64)(0x0010000000000000LL))); f64 y = x; if (n > 1023) { y *= x1p1023; n -= 1023; if (n > 1023) { y *= x1p1023; n -= 1023; if (n > 1023) { n = 1023; } } } else if (n < -1022) { y *= x1p_1022 * x1p53; n += 969; if (n < -1022) { y *= x1p_1022 * x1p53; n += 969; if (n < -1022) { n = -1022; } } } return y * math__f64_from_bits(v__lshift_u64(((u64)((0x3ff + n))), (u64)52)); } inline f64 math__cos(f64 a) { return cos(a); } inline f64 math__sin(f64 a) { return sin(a); } inline f32 math__cosf(f32 a) { return cosf(a); } inline f32 math__sinf(f32 a) { return sinf(a); } f64 math__pure_v_but_overridden_by_c_sin(f64 x) { f64 p1 = 7.85398125648498535156e-1; f64 p2 = 3.77489470793079817668e-8; f64 p3 = 2.69515142907905952645e-15; int sgn_x = (x < 0 ? (-1) : (1)); f64 abs_x = math__abs_T_f64(x); if (abs_x < ((f64)(_const_math__internal__root4_f64_epsilon))) { f64 x2 = x * x; return x * (((f64)(1.0)) - x2 / ((f64)(6.0))); } else { int sgn_result = sgn_x; f64 y = math__floor(abs_x / ((f64)(0.7853981633974483))); int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); if (((octant & 1)) == 1) { octant++; octant &= 7; y += 1.0; } if (octant > 3) { octant -= 4; sgn_result = -sgn_result; } f64 z = ((abs_x - y * p1) - y * p2) - y * p3; f64 result = 0.0; if (octant == 0) { f64 t = ((f64)(8.0)) * math__abs_T_f64(z) / ((f64)(_const_math__pi)) - ((f64)(1.0)); multi_return_f64_f64 mr_1722 = math__ChebSeries_eval_e(_const_math__sin_cs, t); f64 sin_cs_val = mr_1722.arg0; result = z * (((f64)(1.0)) + z * z * sin_cs_val); } else { f64 t = ((f64)(8.0)) * math__abs_T_f64(z) / ((f64)(_const_math__pi)) - ((f64)(1.0)); multi_return_f64_f64 mr_1845 = math__ChebSeries_eval_e(_const_math__cos_cs, t); f64 cos_cs_val = mr_1845.arg0; result = ((f64)(1.0)) - ((f64)(0.5)) * z * z * (((f64)(1.0)) - z * z * cos_cs_val); } result *= sgn_result; return result; } return 0; } f64 math__pure_v_but_overridden_by_c_cos(f64 x) { f64 p1 = 7.85398125648498535156e-1; f64 p2 = 3.77489470793079817668e-8; f64 p3 = 2.69515142907905952645e-15; f64 abs_x = math__abs_T_f64(x); if (abs_x < ((f64)(_const_math__internal__root4_f64_epsilon))) { f64 x2 = x * x; return ((f64)(1.0)) - ((f64)(0.5)) * x2; } else { int sgn_result = 1; f64 y = math__floor(abs_x / ((f64)(0.7853981633974483))); int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); if (((octant & 1)) == 1) { octant++; octant &= 7; y += 1.0; } if (octant > 3) { octant -= 4; sgn_result = -sgn_result; } if (octant > 1) { sgn_result = -sgn_result; } f64 z = ((abs_x - y * p1) - y * p2) - y * p3; f64 result = 0.0; if (octant == 0) { f64 t = ((f64)(8.0)) * math__abs_T_f64(z) / ((f64)(_const_math__pi)) - ((f64)(1.0)); multi_return_f64_f64 mr_2686 = math__ChebSeries_eval_e(_const_math__cos_cs, t); f64 cos_cs_val = mr_2686.arg0; result = ((f64)(1.0)) - ((f64)(0.5)) * z * z * (((f64)(1.0)) - z * z * cos_cs_val); } else { f64 t = ((f64)(8.0)) * math__abs_T_f64(z) / ((f64)(_const_math__pi)) - ((f64)(1.0)); multi_return_f64_f64 mr_2825 = math__ChebSeries_eval_e(_const_math__sin_cs, t); f64 sin_cs_val = mr_2825.arg0; result = z * (((f64)(1.0)) + z * z * sin_cs_val); } result *= sgn_result; return result; } return 0; } inline f32 math__pure_v_but_overridden_by_c_cosf(f32 a) { return ((f32)(math__cos(a))); } inline f32 math__pure_v_but_overridden_by_c_sinf(f32 a) { return ((f32)(math__sin(a))); } multi_return_f64_f64 math__sincos(f64 x) { if (math__is_nan(x)) { return (multi_return_f64_f64){.arg0=x, .arg1=x}; } f64 p1 = 7.85398125648498535156e-1; f64 p2 = 3.77489470793079817668e-8; f64 p3 = 2.69515142907905952645e-15; int sgn_x = (x < 0 ? (-1) : (1)); f64 abs_x = math__abs_T_f64(x); if (math__is_inf(x, sgn_x)) { return (multi_return_f64_f64){.arg0=math__nan(), .arg1=math__nan()}; } if (abs_x < ((f64)(_const_math__internal__root4_f64_epsilon))) { f64 x2 = x * x; return (multi_return_f64_f64){.arg0=x * (((f64)(1.0)) - x2 / ((f64)(6.0))), .arg1=((f64)(1.0)) - ((f64)(0.5)) * x2}; } else { int sgn_result_sin = sgn_x; int sgn_result_cos = 1; f64 y = math__floor(abs_x / ((f64)(0.7853981633974483))); int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); if (((octant & 1)) == 1) { octant++; octant &= 7; y += 1.0; } if (octant > 3) { octant -= 4; sgn_result_sin = -sgn_result_sin; sgn_result_cos = -sgn_result_cos; } sgn_result_cos = (octant > 1 ? (-sgn_result_cos) : (sgn_result_cos)); f64 z = ((abs_x - y * p1) - y * p2) - y * p3; f64 t = ((f64)(8.0)) * math__abs_T_f64(z) / ((f64)(_const_math__pi)) - ((f64)(1.0)); multi_return_f64_f64 mr_4085 = math__ChebSeries_eval_e(_const_math__sin_cs, t); f64 sin_cs_val = mr_4085.arg0; multi_return_f64_f64 mr_4121 = math__ChebSeries_eval_e(_const_math__cos_cs, t); f64 cos_cs_val = mr_4121.arg0; f64 result_sin = 0.0; f64 result_cos = 0.0; if (octant == 0) { result_sin = z * (((f64)(1.0)) + z * z * sin_cs_val); result_cos = ((f64)(1.0)) - ((f64)(0.5)) * z * z * (((f64)(1.0)) - z * z * cos_cs_val); } else { result_sin = ((f64)(1.0)) - ((f64)(0.5)) * z * z * (((f64)(1.0)) - z * z * cos_cs_val); result_cos = z * (((f64)(1.0)) + z * z * sin_cs_val); } result_sin *= sgn_result_sin; result_cos *= sgn_result_cos; return (multi_return_f64_f64){.arg0=result_sin, .arg1=result_cos}; } return (multi_return_f64_f64){0}; } f64 math__sinh(f64 x_) { f64 x = x_; f64 p0 = -0.6307673640497716991184787251e+6; f64 p1 = -0.8991272022039509355398013511e+5; f64 p2 = -0.2894211355989563807284660366e+4; f64 p3 = -0.2630563213397497062819489e+2; f64 q0 = -0.6307673640497716991212077277e+6; f64 q1 = 0.1521517378790019070696485176e+5; f64 q2 = -0.173678953558233699533450911e+3; bool neg = false; if (x < 0) { x = -x; neg = true; } f64 temp = 0.0; if (x > 21) { temp = math__exp(x) * ((f64)(0.5)); } else if (x > ((f64)(0.5))) { f64 ex = math__exp(x); temp = (ex - ((f64)(1.0)) / ex) * ((f64)(0.5)); } else { f64 sq = x * x; temp = (((p3 * sq + p2) * sq + p1) * sq + p0) * x; temp = temp / (((sq + q2) * sq + q1) * sq + q0); } if (neg) { temp = -temp; } return temp; } f64 math__cosh(f64 x) { f64 abs_x = math__abs_T_f64(x); if (abs_x > 21) { return math__exp(abs_x) * ((f64)(0.5)); } f64 ex = math__exp(abs_x); return (ex + ((f64)(1.0)) / ex) * ((f64)(0.5)); } inline f64 math__sqrt(f64 a) { return sqrt(a); } inline f32 math__sqrtf(f32 a) { return sqrtf(a); } inline f64 math__pure_v_but_overridden_by_c_sqrt(f64 a) { f64 x = a; if (x == ((f64)(0.0)) || math__is_nan(x) || math__is_inf(x, 1)) { return x; } if (x < ((f64)(0.0))) { return math__nan(); } multi_return_f64_int mr_259 = math__frexp(x); f64 z = mr_259.arg0; int ex = mr_259.arg1; f64 w = x; x = ((f64)(4.173075996388649989089e-1)) + ((f64)(5.9016206709064458299663e-1)) * z; if (((ex & 1)) != 0) { x *= _const_math__sqrt2; } x = math__ldexp(x, v__rshift_int(ex, (u64)1)); x = ((f64)(0.5)) * (x + w / x); x = ((f64)(0.5)) * (x + w / x); x = ((f64)(0.5)) * (x + w / x); return x; } inline f32 math__pure_v_but_overridden_by_c_sqrtf(f32 a) { return ((f32)(math__sqrt(a))); } i64 math__sqrti(i64 a) { i64 x = a; i64 q = ((i64)(1)); i64 r = ((i64)(0)); for (; q <= x; ) { q = v__lshift_i64(q, (u64)2); } for (; q > 1; ) { q = v__rshift_i64(q, (u64)2); i64 t = x - r - q; r = v__rshift_i64(r, (u64)1); if (t >= 0) { x = t; r += q; } } return r; } inline f32 math__tanf(f32 a) { return tanf(a); } f64 math__tan(f64 a) { f64 x = a; if (x == ((f64)(0.0)) || math__is_nan(x)) { return x; } if (math__is_inf(x, 0)) { return math__nan(); } int sgn = 1; if (x < 0) { x = -x; sgn = -1; } if (x > ((f64)(_const_math__tan_lossth))) { return 0.0; } f64 y = math__floor(x * ((f64)(4.0)) / ((f64)(_const_math__pi))); f64 z = math__ldexp(y, -3); z = math__floor(z); z = y - math__ldexp(z, 3); int octant = ((int)(z)); if (((octant & 1)) == 1) { octant++; y += 1.0; } z = ((x - y * ((f64)(_const_math__tan_dp1))) - y * ((f64)(_const_math__tan_dp2))) - y * ((f64)(_const_math__tan_dp3)); f64 zz = z * z; if (zz > ((f64)(1.0e-14))) { y = z + z * (zz * ((((*(f64*)builtin__array_get(_const_math__tan_p, 0)) * zz) + (*(f64*)builtin__array_get(_const_math__tan_p, 1))) * zz + (*(f64*)builtin__array_get(_const_math__tan_p, 2))) / ((((zz + (*(f64*)builtin__array_get(_const_math__tan_q, 1))) * zz + (*(f64*)builtin__array_get(_const_math__tan_q, 2))) * zz + (*(f64*)builtin__array_get(_const_math__tan_q, 3))) * zz + (*(f64*)builtin__array_get(_const_math__tan_q, 4)))); } else { y = z; } if (((octant & 2)) == 2) { y = ((f64)(-1.0)) / y; } if (sgn < 0) { y = -y; } return y; } inline f32 math__pure_v_but_overridden_by_c_tanf(f32 a) { return ((f32)(math__tan(a))); } f64 math__cot(f64 a) { f64 x = a; if (x == ((f64)(0.0))) { return math__inf(1); } int sgn = 1; if (x < 0) { x = -x; sgn = -1; } if (x > ((f64)(_const_math__tan_lossth))) { return 0.0; } f64 y = math__floor(x * ((f64)(4.0)) / ((f64)(_const_math__pi))); f64 z = math__ldexp(y, -3); z = math__floor(z); z = y - math__ldexp(z, 3); int octant = ((int)(z)); if (((octant & 1)) == 1) { octant++; y += 1.0; } z = ((x - y * ((f64)(_const_math__tan_dp1))) - y * ((f64)(_const_math__tan_dp2))) - y * ((f64)(_const_math__tan_dp3)); f64 zz = z * z; if (zz > ((f64)(1.0e-14))) { y = z + z * (zz * ((((*(f64*)builtin__array_get(_const_math__tan_p, 0)) * zz) + (*(f64*)builtin__array_get(_const_math__tan_p, 1))) * zz + (*(f64*)builtin__array_get(_const_math__tan_p, 2))) / ((((zz + (*(f64*)builtin__array_get(_const_math__tan_q, 1))) * zz + (*(f64*)builtin__array_get(_const_math__tan_q, 2))) * zz + (*(f64*)builtin__array_get(_const_math__tan_q, 3))) * zz + (*(f64*)builtin__array_get(_const_math__tan_q, 4)))); } else { y = z; } if (((octant & 2)) == 2) { y = -y; } else { y = ((f64)(1.0)) / y; } if (sgn < 0) { y = -y; } return y; } f64 math__tanh(f64 x) { f64 maxlog = 8.8029691931113054295988e+01; f64 z = math__abs_T_f64(x); if (z > ((f64)(0.5)) * maxlog) { if (x < 0) { return ((f64)(-1)); } return 1.0; } else if (z >= ((f64)(0.625))) { f64 s = math__exp(((f64)(2.0)) * z); z = ((f64)(1.0)) - ((f64)(2.0)) / (s + ((f64)(1.0))); if (x < 0) { z = -z; } } else { if (x == 0) { return x; } f64 s = x * x; z = x + x * s * (((*(f64*)builtin__array_get(_const_math__tanh_p, 0)) * s + (*(f64*)builtin__array_get(_const_math__tanh_p, 1))) * s + (*(f64*)builtin__array_get(_const_math__tanh_p, 2))) / (((s + (*(f64*)builtin__array_get(_const_math__tanh_q, 0))) * s + (*(f64*)builtin__array_get(_const_math__tanh_q, 1))) * s + (*(f64*)builtin__array_get(_const_math__tanh_q, 2))); } return z; } inline u32 math__f32_bits(f32 f) { #if defined(__TINYC__) { return *((u32*)(&f)); } #endif return ((math__U32_F32){.f = f,}).u; } inline f32 math__f32_from_bits(u32 b) { #if defined(__TINYC__) { return *((f32*)(&b)); } #endif return ((math__U32_F32){.u = b,}).f; } inline u64 math__f64_bits(f64 f) { #if defined(__TINYC__) { return *((u64*)(&f)); } #endif return ((math__U64_F64){.f = f,}).u; } inline f64 math__f64_from_bits(u64 b) { #if defined(__TINYC__) { return *((f64*)(&b)); } #endif return ((math__U64_F64){.u = b,}).f; } inline f64 math__with_set_low_word(f64 f, u32 lo) { u64 tmp = math__f64_bits(f); tmp &= 0xffffffff00000000ULL; tmp |= ((u64)(lo)); return math__f64_from_bits(tmp); } inline f64 math__with_set_high_word(f64 f, u32 hi) { u64 tmp = math__f64_bits(f); tmp &= 0x00000000ffffffffU; tmp |= v__lshift_u64(((u64)(hi)), (u64)32); return math__f64_from_bits(tmp); } inline u32 math__get_high_word(f64 f) { return ((u32)(v__rshift_u64(math__f64_bits(f), (u64)32))); } VV_LOC void main__vf_init(void) { string probe = _S("vf"); {int _ = probe.len;} ; } // export alias: vf_init -> main__vf_init void vf_init(void) { return main__vf_init(); } VV_LOC int main__vf_add(int a, int b) { return a + b; } // export alias: vf_add -> main__vf_add int vf_add(int a, int b) { return main__vf_add(a, b); } VV_LOC char* main__vf_greet(char* name) { string n = builtin__cstring_to_vstring(name); string res = builtin__string_plus_many(3, _MOV((string[3]){_S("Hello, "), n, _S(", from V!")})); u8* out = res.str; builtin__string_free(&n); return out; } // export alias: vf_greet -> main__vf_greet char* vf_greet(char* name) { return main__vf_greet(name); } VV_LOC void main__vf_free(voidptr p) { builtin___v_free(p); } // export alias: vf_free -> main__vf_free void vf_free(voidptr p) { return main__vf_free(p); } VV_LOC void main__vf_mandelbrot(u8* buf, int w, int h, f64 cx, f64 cy, f64 scale, int max_iter, int y0, int y1) { if (w <= 0 || h <= 0 || max_iter <= 0) { return; } f64 aspect = ((f64)(w)) / ((f64)(h)); f64 inv_w = ((f64)(1.0)) / ((f64)(w)); f64 inv_h = ((f64)(1.0)) / ((f64)(h)); for (int y = y0; y < y1; y++) { f64 im = cy + (((f64)(y)) * inv_h - ((f64)(0.5))) * scale; int row = (y - y0) * w * 4; for (int x = 0; x < w; x++) { f64 re = cx + (((f64)(x)) * inv_w - ((f64)(0.5))) * scale * aspect; f64 zr = 0.0; f64 zi = 0.0; f64 zr2 = 0.0; f64 zi2 = 0.0; int i = 0; for (;;) { if (!(i < max_iter)) break; zr2 = zr * zr; zi2 = zi * zi; if (zr2 + zi2 > ((f64)(4.0))) { break; } zi = ((f64)(2.0)) * zr * zi + im; zr = zr2 - zi2 + re; i++; } int idx = row + x * 4; if (i >= max_iter) { { // Unsafe block buf[idx] = ((u8)(0)); buf[idx + 1] = ((u8)(0)); buf[idx + 2] = ((u8)(0)); buf[idx + 3] = ((u8)(255)); } continue; } f64 mag = math__sqrt(zr2 + zi2); f64 nu = ((f64)(i)); if (mag > ((f64)(1.0))) { nu = ((f64)(i)) + ((f64)(1.0)) - math__log(math__log(mag) / math__log(2.0)) / math__log(2.0); } f64 t = nu / ((f64)(max_iter)); { // Unsafe block buf[idx] = ((u8)(((f64)(255.0)) * (((f64)(0.5)) + ((f64)(0.5)) * math__sin(((f64)(3.0)) + t * ((f64)(18.0)))))); buf[idx + 1] = ((u8)(((f64)(255.0)) * (((f64)(0.5)) + ((f64)(0.5)) * math__sin(((f64)(3.6)) + t * ((f64)(18.0)))))); buf[idx + 2] = ((u8)(((f64)(255.0)) * (((f64)(0.5)) + ((f64)(0.5)) * math__sin(((f64)(4.2)) + t * ((f64)(18.0)))))); buf[idx + 3] = ((u8)(255)); } } } } // export alias: vf_mandelbrot -> main__vf_mandelbrot void vf_mandelbrot(u8* buf, int w, int h, f64 cx, f64 cy, f64 scale, int max_iter, int y0, int y1) { return main__vf_mandelbrot(buf, w, h, cx, cy, scale, max_iter, y0, y1); } VV_LOC void main__main(void) { } inline f64 math__abs_T_f64(f64 a) { return (a < 0 ? (-a) : (a)); } void _vinit(int ___argc, voidptr ___argv) { static bool once = false; if (once) {return;} once = true; // Initializations of consts for module builtin.closure g_closure = ((builtin__closure__Closure){.ClosureMutex = ((builtin__closure__ClosureMutex){.closure_mtx = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},}),.closure_ptr = 0,.closure_get_data = ((void*)0),.closure_cap = 0,.free_closure_ptr = 0,.pages = ((void*)0),.v_page_size = ((int)(0x4000)),.live = builtin__new_map(sizeof(voidptr), sizeof(builtin__closure__ClosureLiveInfo), &builtin__map_hash_int_8, &builtin__map_eq_int_8, &builtin__map_clone_int_8, &builtin__map_free_nop),.active_lifetimes = builtin__new_map(sizeof(u64), sizeof(builtin__closure__ClosureLifetimeState*), &builtin__map_hash_int_8, &builtin__map_eq_int_8, &builtin__map_clone_int_8, &builtin__map_free_nop),.next_generation = 0,.free_lifetime_states = ((void*)0),.next_lifetime_generation = 0,.lifetime_state_allocs = 0,}); // global 3 { { Array_fixed_u8_15 _t1; #if defined(__V_ppc64le) #elif !defined(__V_ppc64le) && !defined(__V_amd64) && !defined(__V_x86) && !defined(__V_arm64) && !defined(__V_arm32) && !defined(__V_rv64) && !defined(__V_rv32) && !defined(__V_s390x) && !defined(__V_loongarch64) #elif defined(__V_amd64) { Array_fixed_u8_15 _t2 = {((u8)(0xF3)), 0x44, 0x0F, 0x7E, 0x3D, 0xF7, 0xBF, 0xFF, 0xFF, 0xFF, 0x25, 0xF9, 0xBF, 0xFF, 0xFF} ; memcpy(&_t1, &_t2, sizeof(Array_fixed_u8_15)); } ; #elif defined(__V_x86) #elif defined(__V_arm64) #elif defined(__V_arm32) #elif defined(__V_rv64) #elif defined(__V_rv32) #elif defined(__V_s390x) #elif defined(__V_loongarch64) #elif defined(__V_sparc64) #elif 0 #else #endif memcpy(&_const_builtin__closure__closure_thunk, &_t1, sizeof(Array_fixed_u8_15)); } } { { Array_fixed_u8_6 _t3; #if !defined(__V_ppc64le) && !defined(__V_amd64) && !defined(__V_x86) && !defined(__V_arm64) && !defined(__V_arm32) && !defined(__V_rv64) && !defined(__V_rv32) && !defined(__V_s390x) && !defined(__V_loongarch64) #elif defined(__V_arm32) #elif defined(__V_amd64) { Array_fixed_u8_6 _t4 = {((u8)(0x66)), 0x4C, 0x0F, 0x7E, 0xF8, 0xC3} ; memcpy(&_t3, &_t4, sizeof(Array_fixed_u8_6)); } ; #elif defined(__V_x86) #elif defined(__V_arm64) #elif defined(__V_rv64) #elif defined(__V_rv32) #elif defined(__V_s390x) #elif defined(__V_ppc64le) #elif defined(__V_loongarch64) #elif defined(__V_sparc64) #elif 0 #else #endif memcpy(&_const_builtin__closure__closure_get_data_bytes, &_t3, sizeof(Array_fixed_u8_6)); } } { { _const_builtin__closure__closure_size_1 = (2 * ((u32)(sizeof(voidptr))) > ((u32)(15)) ? (2 * ((u32)(sizeof(voidptr)))) : (((u32)(15)) + ((u32)(sizeof(voidptr))) - 1)); } } _const_builtin__closure__closure_size = ((int)((_const_builtin__closure__closure_size_1 & ~(((u32)(sizeof(voidptr))) - 1)))); // Initializations of consts for module math.bits _const_math__bits__overflow_error = _S("Overflow Error"); _const_math__bits__divide_error = _S("Divide by Zero Error"); // Initializations of consts for module strconv _const_strconv__digit_pairs = _S("00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999"); _const_strconv__base_digits = _S("0123456789abcdefghijklmnopqrstuvwxyz"); _const_strconv__i64_min_int32 = ((i64)(-2147483647)) - 1; _const_strconv__i64_max_int32 = ((i64)(2147483646)) + 1; // Initializations of consts for module builtin _const_grapheme_control_ranges = _S("00000000090000000b0000000c0000000e0000001f0000007f0000009f000000ad000000ad0000001c0600001c0600000e1800000e1800000b2000000b2000000e2000000f200000282000002820000029200000292000002a2000002e20000060200000642000006520000065200000662000006f200000fffe0000fffe0000f0ff0000f8ff0000f9ff0000fbff00003034010038340100a0bc0100a3bc010073d101007ad1010000000e0000000e0001000e0001000e0002000e001f000e0080000e00ff000e00f0010e00ff0f0e00"); _const_grapheme_extend_ranges = _S("000300006f0300008304000087040000880400008904000091050000bd050000bf050000bf050000c1050000c2050000c4050000c5050000c7050000c7050000100600001a0600004b0600005f0600007006000070060000d6060000dc060000df060000e4060000e7060000e8060000ea060000ed0600001107000011070000300700004a070000a6070000b0070000eb070000f3070000fd070000fd07000016080000190800001b080000230800002508000027080000290800002d080000590800005b080000d3080000e1080000e3080000020900003a0900003a0900003c0900003c09000041090000480900004d0900004d090000510900005709000062090000630900008109000081090000bc090000bc090000be090000be090000c1090000c4090000cd090000cd090000d7090000d7090000e2090000e3090000fe090000fe090000010a0000020a00003c0a00003c0a0000410a0000420a0000470a0000480a00004b0a00004d0a0000510a0000510a0000700a0000710a0000750a0000750a0000810a0000820a0000bc0a0000bc0a0000c10a0000c50a0000c70a0000c80a0000cd0a0000cd0a0000e20a0000e30a0000fa0a0000ff0a0000010b0000010b00003c0b00003c0b00003e0b00003e0b00003f0b00003f0b0000410b0000440b00004d0b00004d0b0000550b0000560b0000570b0000570b0000620b0000630b0000820b0000820b0000be0b0000be0b0000c00b0000c00b0000cd0b0000cd0b0000d70b0000d70b0000000c0000000c0000040c0000040c00003e0c0000400c0000460c0000480c00004a0c00004d0c0000550c0000560c0000620c0000630c0000810c0000810c0000bc0c0000bc0c0000bf0c0000bf0c0000c20c0000c20c0000c60c0000c60c0000cc0c0000cd0c0000d50c0000d60c0000e20c0000e30c0000000d0000010d00003b0d00003c0d00003e0d00003e0d0000410d0000440d00004d0d00004d0d0000570d0000570d0000620d0000630d0000810d0000810d0000ca0d0000ca0d0000cf0d0000cf0d0000d20d0000d40d0000d60d0000d60d0000df0d0000df0d0000310e0000310e0000340e00003a0e0000470e00004e0e0000b10e0000b10e0000b40e0000bc0e0000c80e0000cd0e0000180f0000190f0000350f0000350f0000370f0000370f0000390f0000390f0000710f00007e0f0000800f0000840f0000860f0000870f00008d0f0000970f0000990f0000bc0f0000c60f0000c60f00002d100000301000003210000037100000391000003a1000003d1000003e10000058100000591000005e100000601000007110000074100000821000008210000085100000861000008d1000008d1000009d1000009d1000005d1300005f1300001217000014170000321700003417000052170000531700007217000073170000b4170000b5170000b7170000bd170000c6170000c6170000c9170000d3170000dd170000dd1700000b1800000d1800008518000086180000a9180000a9180000201900002219000027190000281900003219000032190000391900003b190000171a0000181a00001b1a00001b1a0000561a0000561a0000581a00005e1a0000601a0000601a0000621a0000621a0000651a00006c1a0000731a00007c1a00007f1a00007f1a0000b01a0000bd1a0000be1a0000be1a0000bf1a0000c01a0000001b0000031b0000341b0000341b0000351b0000351b0000361b00003a1b00003c1b00003c1b0000421b0000421b00006b1b0000731b0000801b0000811b0000a21b0000a51b0000a81b0000a91b0000ab1b0000ad1b0000e61b0000e61b0000e81b0000e91b0000ed1b0000ed1b0000ef1b0000f11b00002c1c0000331c0000361c0000371c0000d01c0000d21c0000d41c0000e01c0000e21c0000e81c0000ed1c0000ed1c0000f41c0000f41c0000f81c0000f91c0000c01d0000f91d0000fb1d0000ff1d00000c2000000c200000d0200000dc200000dd200000e0200000e1200000e1200000e2200000e4200000e5200000f0200000ef2c0000f12c00007f2d00007f2d0000e02d0000ff2d00002a3000002d3000002e3000002f300000993000009a3000006fa600006fa6000070a6000072a6000074a600007da600009ea600009fa60000f0a60000f1a6000002a8000002a8000006a8000006a800000ba800000ba8000025a8000026a800002ca800002ca80000c4a80000c5a80000e0a80000f1a80000ffa80000ffa8000026a900002da9000047a9000051a9000080a9000082a90000b3a90000b3a90000b6a90000b9a90000bca90000bda90000e5a90000e5a9000029aa00002eaa000031aa000032aa000035aa000036aa000043aa000043aa00004caa00004caa00007caa00007caa0000b0aa0000b0aa0000b2aa0000b4aa0000b7aa0000b8aa0000beaa0000bfaa0000c1aa0000c1aa0000ecaa0000edaa0000f6aa0000f6aa0000e5ab0000e5ab0000e8ab0000e8ab0000edab0000edab00001efb00001efb000000fe00000ffe000020fe00002ffe00009eff00009fff0000fd010100fd010100e0020100e0020100760301007a030100010a0100030a0100050a0100060a01000c0a01000f0a0100380a01003a0a01003f0a01003f0a0100e50a0100e60a0100240d0100270d0100ab0e0100ac0e0100460f0100500f0100011001000110010038100100461001007f10010081100100b3100100b6100100b9100100ba1001000011010002110100271101002b1101002d1101003411010073110100731101008011010081110100b6110100be110100c9110100cc110100cf110100cf1101002f12010031120100341201003412010036120100371201003e1201003e120100df120100df120100e3120100ea12010000130100011301003b1301003c1301003e1301003e13010040130100401301005713010057130100661301006c1301007013010074130100381401003f140100421401004414010046140100461401005e1401005e140100b0140100b0140100b3140100b8140100ba140100ba140100bd140100bd140100bf140100c0140100c2140100c3140100af150100af150100b2150100b5150100bc150100bd150100bf150100c0150100dc150100dd150100331601003a1601003d1601003d1601003f16010040160100ab160100ab160100ad160100ad160100b0160100b5160100b7160100b71601001d1701001f1701002217010025170100271701002b1701002f18010037180100391801003a18010030190100301901003b1901003c1901003e1901003e1901004319010043190100d4190100d7190100da190100db190100e0190100e0190100011a01000a1a0100331a0100381a01003b1a01003e1a0100471a0100471a0100511a0100561a0100591a01005b1a01008a1a0100961a0100981a0100991a0100301c0100361c0100381c01003d1c01003f1c01003f1c0100921c0100a71c0100aa1c0100b01c0100b21c0100b31c0100b51c0100b61c0100311d0100361d01003a1d01003a1d01003c1d01003d1d01003f1d0100451d0100471d0100471d0100901d0100911d0100951d0100951d0100971d0100971d0100f31e0100f41e0100f06a0100f46a0100306b0100366b01004f6f01004f6f01008f6f0100926f0100e46f0100e46f01009dbc01009ebc010065d1010065d1010067d1010069d101006ed1010072d101007bd1010082d1010085d101008bd10100aad10100add1010042d2010044d2010000da010036da01003bda01006cda010075da010075da010084da010084da01009bda01009fda0100a1da0100afda010000e0010006e0010008e0010018e001001be0010021e0010023e0010024e0010026e001002ae0010030e1010036e10100ece20100efe20100d0e80100d6e8010044e901004ae90100fbf30100fff3010020000e007f000e0000010e00ef010e00"); _const_grapheme_spacing_mark_ranges = _S("03090000030900003b0900003b0900003e09000040090000490900004c0900004e0900004f0900008209000083090000bf090000c0090000c7090000c8090000cb090000cc090000030a0000030a00003e0a0000400a0000830a0000830a0000be0a0000c00a0000c90a0000c90a0000cb0a0000cc0a0000020b0000030b0000400b0000400b0000470b0000480b00004b0b00004c0b0000bf0b0000bf0b0000c10b0000c20b0000c60b0000c80b0000ca0b0000cc0b0000010c0000030c0000410c0000440c0000820c0000830c0000be0c0000be0c0000c00c0000c10c0000c30c0000c40c0000c70c0000c80c0000ca0c0000cb0c0000020d0000030d00003f0d0000400d0000460d0000480d00004a0d00004c0d0000820d0000830d0000d00d0000d10d0000d80d0000de0d0000f20d0000f30d0000330e0000330e0000b30e0000b30e00003e0f00003f0f00007f0f00007f0f000031100000311000003b1000003c10000056100000571000008410000084100000b6170000b6170000be170000c5170000c7170000c81700002319000026190000291900002b19000030190000311900003319000038190000191a00001a1a0000551a0000551a0000571a0000571a00006d1a0000721a0000041b0000041b00003b1b00003b1b00003d1b0000411b0000431b0000441b0000821b0000821b0000a11b0000a11b0000a61b0000a71b0000aa1b0000aa1b0000e71b0000e71b0000ea1b0000ec1b0000ee1b0000ee1b0000f21b0000f31b0000241c00002b1c0000341c0000351c0000e11c0000e11c0000f71c0000f71c000023a8000024a8000027a8000027a8000080a8000081a80000b4a80000c3a8000052a9000053a9000083a9000083a90000b4a90000b5a90000baa90000bba90000bea90000c0a900002faa000030aa000033aa000034aa00004daa00004daa0000ebaa0000ebaa0000eeaa0000efaa0000f5aa0000f5aa0000e3ab0000e4ab0000e6ab0000e7ab0000e9ab0000eaab0000ecab0000ecab0000001001000010010002100100021001008210010082100100b0100100b2100100b7100100b81001002c1101002c11010045110100461101008211010082110100b3110100b5110100bf110100c0110100ce110100ce1101002c1201002e12010032120100331201003512010035120100e0120100e212010002130100031301003f1301003f130100411301004413010047130100481301004b1301004d1301006213010063130100351401003714010040140100411401004514010045140100b1140100b2140100b9140100b9140100bb140100bc140100be140100be140100c1140100c1140100b0150100b1150100b8150100bb150100be150100be15010030160100321601003b1601003c1601003e1601003e160100ac160100ac160100ae160100af160100b6160100b6160100201701002117010026170100261701002c1801002e1801003818010038180100311901003519010037190100381901003d1901003d19010040190100401901004219010042190100d1190100d3190100dc190100df190100e4190100e4190100391a0100391a0100571a0100581a0100971a0100971a01002f1c01002f1c01003e1c01003e1c0100a91c0100a91c0100b11c0100b11c0100b41c0100b41c01008a1d01008e1d0100931d0100941d0100961d0100961d0100f51e0100f61e0100516f0100876f0100f06f0100f16f010066d1010066d101006dd101006dd10100"); _const_grapheme_prepend_ranges = _S("0006000005060000dd060000dd0600000f0700000f070000e2080000e20800004e0d00004e0d0000bd100100bd100100cd100100cd100100c2110100c31101003f1901003f19010041190100411901003a1a01003a1a0100841a0100891a0100461d0100461d0100"); _const_grapheme_extended_pictographic_ranges = _S("a9000000a9000000ae000000ae0000003c2000003c2000004920000049200000222100002221000039210000392100009421000099210000a9210000aa2100001a2300001b23000028230000282300008823000088230000cf230000cf230000e9230000ec230000ed230000ee230000ef230000ef230000f0230000f0230000f1230000f2230000f3230000f3230000f8230000fa230000c2240000c2240000aa250000ab250000b6250000b6250000c0250000c0250000fb250000fe2500000026000001260000022600000326000004260000042600000526000005260000072600000d2600000e2600000e2600000f2600001026000011260000112600001226000012260000142600001526000016260000172600001826000018260000192600001c2600001d2600001d2600001e2600001f2600002026000020260000212600002126000022260000232600002426000025260000262600002626000027260000292600002a2600002a2600002b2600002d2600002e2600002e2600002f2600002f260000302600003726000038260000392600003a2600003a2600003b2600003f26000040260000402600004126000041260000422600004226000043260000472600004826000053260000542600005e2600005f2600005f2600006026000060260000612600006226000063260000632600006426000064260000652600006626000067260000672600006826000068260000692600007a2600007b2600007b2600007c2600007d2600007e2600007e2600007f2600007f2600008026000085260000902600009126000092260000922600009326000093260000942600009426000095260000952600009626000097260000982600009826000099260000992600009a2600009a2600009b2600009c2600009d2600009f260000a0260000a1260000a2260000a6260000a7260000a7260000a8260000a9260000aa260000ab260000ac260000af260000b0260000b1260000b2260000bc260000bd260000be260000bf260000c3260000c4260000c5260000c6260000c7260000c8260000c8260000c9260000cd260000ce260000ce260000cf260000cf260000d0260000d0260000d1260000d1260000d2260000d2260000d3260000d3260000d4260000d4260000d5260000e8260000e9260000e9260000ea260000ea260000eb260000ef260000f0260000f1260000f2260000f3260000f4260000f4260000f5260000f5260000f6260000f6260000f7260000f9260000fa260000fa260000fb260000fc260000fd260000fd260000fe26000001270000022700000227000003270000042700000527000005270000082700000c2700000d2700000d2700000e2700000e2700000f2700000f27000010270000112700001227000012270000142700001427000016270000162700001d2700001d270000212700002127000028270000282700003327000034270000442700004427000047270000472700004c2700004c2700004e2700004e270000532700005527000057270000572700006327000063270000642700006427000065270000672700009527000097270000a1270000a1270000b0270000b0270000bf270000bf2700003429000035290000052b0000072b00001b2b00001c2b0000502b0000502b0000552b0000552b000030300000303000003d3000003d3000009732000097320000993200009932000000f0010003f0010004f0010004f0010005f00100cef00100cff00100cff00100d0f00100fff001000df101000ff101002ff101002ff101006cf101006ff1010070f1010071f101007ef101007ff101008ef101008ef1010091f101009af10100adf10100e5f1010001f2010002f2010003f201000ff201001af201001af201002ff201002ff2010032f201003af201003cf201003ff2010049f201004ff2010050f2010051f2010052f20100fff2010000f301000cf301000df301000ef301000ff301000ff3010010f3010010f3010011f3010011f3010012f3010012f3010013f3010015f3010016f3010018f3010019f3010019f301001af301001af301001bf301001bf301001cf301001cf301001df301001ef301001ff3010020f3010021f3010021f3010022f3010023f3010024f301002cf301002df301002ff3010030f3010031f3010032f3010033f3010034f3010035f3010036f3010036f3010037f301004af301004bf301004bf301004cf301004ff3010050f3010050f3010051f301007bf301007cf301007cf301007df301007df301007ef301007ff3010080f3010093f3010094f3010095f3010096f3010097f3010098f3010098f3010099f301009bf301009cf301009df301009ef301009ff30100a0f30100c4f30100c5f30100c5f30100c6f30100c6f30100c7f30100c7f30100c8f30100c8f30100c9f30100c9f30100caf30100caf30100cbf30100cef30100cff30100d3f30100d4f30100dff30100e0f30100e3f30100e4f30100e4f30100e5f30100f0f30100f1f30100f2f30100f3f30100f3f30100f4f30100f4f30100f5f30100f5f30100f6f30100f6f30100f7f30100f7f30100f8f30100faf3010000f4010007f4010008f4010008f4010009f401000bf401000cf401000ef401000ff4010010f4010011f4010012f4010013f4010013f4010014f4010014f4010015f4010015f4010016f4010016f4010017f4010029f401002af401002af401002bf401003ef401003ff401003ff4010040f4010040f4010041f4010041f4010042f4010064f4010065f4010065f4010066f401006bf401006cf401006df401006ef40100acf40100adf40100adf40100aef40100b5f40100b6f40100b7f40100b8f40100ebf40100ecf40100edf40100eef40100eef40100eff40100eff40100f0f40100f4f40100f5f40100f5f40100f6f40100f7f40100f8f40100f8f40100f9f40100fcf40100fdf40100fdf40100fef40100fef40100fff4010002f5010003f5010003f5010004f5010007f5010008f5010008f5010009f5010009f501000af5010014f5010015f5010015f5010016f501002bf501002cf501002df501002ef501003df5010046f5010048f5010049f501004af501004bf501004ef501004ff501004ff5010050f501005bf501005cf5010067f5010068f501006ef501006ff5010070f5010071f5010072f5010073f5010079f501007af501007af501007bf5010086f5010087f5010087f5010088f5010089f501008af501008df501008ef501008ff5010090f5010090f5010091f5010094f5010095f5010096f5010097f50100a3f50100a4f50100a4f50100a5f50100a5f50100a6f50100a7f50100a8f50100a8f50100a9f50100b0f50100b1f50100b2f50100b3f50100bbf50100bcf50100bcf50100bdf50100c1f50100c2f50100c4f50100c5f50100d0f50100d1f50100d3f50100d4f50100dbf50100dcf50100def50100dff50100e0f50100e1f50100e1f50100e2f50100e2f50100e3f50100e3f50100e4f50100e7f50100e8f50100e8f50100e9f50100eef50100eff50100eff50100f0f50100f2f50100f3f50100f3f50100f4f50100f9f50100faf50100faf50100fbf50100fff5010000f6010000f6010001f6010006f6010007f6010008f6010009f601000df601000ef601000ef601000ff601000ff6010010f6010010f6010011f6010011f6010012f6010014f6010015f6010015f6010016f6010016f6010017f6010017f6010018f6010018f6010019f6010019f601001af601001af601001bf601001bf601001cf601001ef601001ff601001ff6010020f6010025f6010026f6010027f6010028f601002bf601002cf601002cf601002df601002df601002ef601002ff6010030f6010033f6010034f6010034f6010035f6010035f6010036f6010036f6010037f6010040f6010041f6010044f6010045f601004ff6010080f6010080f6010081f6010082f6010083f6010085f6010086f6010086f6010087f6010087f6010088f6010088f6010089f6010089f601008af601008bf601008cf601008cf601008df601008df601008ef601008ef601008ff601008ff6010090f6010090f6010091f6010093f6010094f6010094f6010095f6010095f6010096f6010096f6010097f6010097f6010098f6010098f6010099f601009af601009bf60100a1f60100a2f60100a2f60100a3f60100a3f60100a4f60100a5f60100a6f60100a6f60100a7f60100adf60100aef60100b1f60100b2f60100b2f60100b3f60100b5f60100b6f60100b6f60100b7f60100b8f60100b9f60100bef60100bff60100bff60100c0f60100c0f60100c1f60100c5f60100c6f60100caf60100cbf60100cbf60100ccf60100ccf60100cdf60100cff60100d0f60100d0f60100d1f60100d2f60100d3f60100d4f60100d5f60100d5f60100d6f60100d7f60100d8f60100dff60100e0f60100e5f60100e6f60100e8f60100e9f60100e9f60100eaf60100eaf60100ebf60100ecf60100edf60100eff60100f0f60100f0f60100f1f60100f2f60100f3f60100f3f60100f4f60100f6f60100f7f60100f8f60100f9f60100f9f60100faf60100faf60100fbf60100fcf60100fdf60100fff6010074f701007ff70100d5f70100dff70100e0f70100ebf70100ecf70100fff701000cf801000ff8010048f801004ff801005af801005ff8010088f801008ff80100aef80100fff801000cf901000cf901000df901000ff9010010f9010018f9010019f901001ef901001ff901001ff9010020f9010027f9010028f901002ff9010030f9010030f9010031f9010032f9010033f901003af901003cf901003ef901003ff901003ff9010040f9010045f9010047f901004bf901004cf901004cf901004df901004ff9010050f901005ef901005ff901006bf901006cf9010070f9010071f9010071f9010072f9010072f9010073f9010076f9010077f9010078f9010079f9010079f901007af901007af901007bf901007bf901007cf901007ff9010080f9010084f9010085f9010091f9010092f9010097f9010098f90100a2f90100a3f90100a4f90100a5f90100aaf90100abf90100adf90100aef90100aff90100b0f90100b9f90100baf90100bff90100c0f90100c0f90100c1f90100c2f90100c3f90100caf90100cbf90100cbf90100ccf90100ccf90100cdf90100cff90100d0f90100e6f90100e7f90100fff9010000fa01006ffa010070fa010073fa010074fa010074fa010075fa010077fa010078fa01007afa01007bfa01007ffa010080fa010082fa010083fa010086fa010087fa01008ffa010090fa010095fa010096fa0100a8fa0100a9fa0100affa0100b0fa0100b6fa0100b7fa0100bffa0100c0fa0100c2fa0100c3fa0100cffa0100d0fa0100d6fa0100d7fa0100fffa010000fc0100fdff0100"); _const_digit_pairs = _S("00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999"); _const_si_s_code = _S("0xfe10"); _const_si_g32_code = _S("0xfe0e"); _const_si_g64_code = _S("0xfe0f"); g_live_reload_info = *(voidptr*)&((voidptr[]){0}[0]); // global 5 _const_error_sentinel = I_MessageError_to_Interface_IError((HEAP(MessageError, ((MessageError){.msg = _S("error"),.code = 0,})))); _const_none__ = I_None___to_Interface_IError((HEAP(None__, ((None__){.Error = ((Error){E_STRUCT}),})))); _const_min_i64 = ((i64)(-9223372036854775807LL - 1)); _const_max_i64 = ((i64)(9223372036854775807LL)); _const_utf8_replacement_rune = ((rune)(0xfffd)); // Initializations of consts for module math { _const_math__bernoulli = builtin__new_array_from_c_array(10, 10, sizeof(f64), _MOV((f64[10]){ 0.08333333333333333, -0.002777777777777778, 0.0007936507936507937, -0.0005952380952380953, 0.0008417508417508417, -0.0019175269175269176, 0.00641025641025641, -0.029550653594771242, 0.1800957401386015, -1.3924322169059011})); } { _const_math__factorials_table = builtin__new_array_from_c_array(171, 171, sizeof(f64), _MOV((f64[171]){ 1.000000000000000000000e+0, 1.000000000000000000000e+0, 2.000000000000000000000e+0, 6.000000000000000000000e+0, 2.400000000000000000000e+1, 1.200000000000000000000e+2, 7.200000000000000000000e+2, 5.040000000000000000000e+3, 4.032000000000000000000e+4, 3.628800000000000000000e+5, 3.628800000000000000000e+6, 3.991680000000000000000e+7, 4.790016000000000000000e+8, 6.227020800000000000000e+9, 8.717829120000000000000e+10, 1.307674368000000000000e+12, 2.092278988800000000000e+13, 3.556874280960000000000e+14, 6.402373705728000000000e+15, 1.216451004088320000000e+17, 2.432902008176640000000e+18, 5.109094217170944000000e+19, 1.124000727777607680000e+21, 2.585201673888497664000e+22, 6.204484017332394393600e+23, 1.551121004333098598400e+25, 4.032914611266056355840e+26, 1.088886945041835216077e+28, 3.048883446117138605015e+29, 8.841761993739701954544e+30, 2.652528598121910586363e+32, 8.222838654177922817726e+33, 2.631308369336935301672e+35, 8.683317618811886495518e+36, 2.952327990396041408476e+38, 1.033314796638614492967e+40, 3.719933267899012174680e+41, 1.376375309122634504632e+43, 5.230226174666011117600e+44, 2.039788208119744335864e+46, 8.159152832478977343456e+47, 3.345252661316380710817e+49, 1.405006117752879898543e+51, 6.041526306337383563736e+52, 2.658271574788448768044e+54, 1.196222208654801945620e+56, 5.502622159812088949850e+57, 2.586232415111681806430e+59, 1.241391559253607267086e+61, 6.082818640342675608723e+62, 3.041409320171337804361e+64, 1.551118753287382280224e+66, 8.065817517094387857166e+67, 4.274883284060025564298e+69, 2.308436973392413804721e+71, 1.269640335365827592597e+73, 7.109985878048634518540e+74, 4.052691950487721675568e+76, 2.350561331282878571829e+78, 1.386831185456898357379e+80, 8.320987112741390144276e+81, 5.075802138772247988009e+83, 3.146997326038793752565e+85, 1.982608315404440064116e+87, 1.268869321858841641034e+89, 8.247650592082470666723e+90, 5.443449390774430640037e+92, 3.647111091818868528825e+94, 2.480035542436830599601e+96, 1.711224524281413113725e+98, 1.197857166996989179607e+100, 8.504785885678623175212e+101, 6.123445837688608686152e+103, 4.470115461512684340891e+105, 3.307885441519386412260e+107, 2.480914081139539809195e+109, 1.885494701666050254988e+111, 1.451830920282858696341e+113, 1.132428117820629783146e+115, 8.946182130782975286851e+116, 7.156945704626380229481e+118, 5.797126020747367985880e+120, 4.753643337012841748421e+122, 3.945523969720658651190e+124, 3.314240134565353266999e+126, 2.817104114380550276949e+128, 2.422709538367273238177e+130, 2.107757298379527717214e+132, 1.854826422573984391148e+134, 1.650795516090846108122e+136, 1.485715964481761497310e+138, 1.352001527678402962552e+140, 1.243841405464130725548e+142, 1.156772507081641574759e+144, 1.087366156656743080274e+146, 1.032997848823905926260e+148, 9.916779348709496892096e+149, 9.619275968248211985333e+151, 9.426890448883247745626e+153, 9.332621544394415268170e+155, 9.332621544394415268170e+157, 9.425947759838359420852e+159, 9.614466715035126609269e+161, 9.902900716486180407547e+163, 1.029901674514562762385e+166, 1.081396758240290900504e+168, 1.146280563734708354534e+170, 1.226520203196137939352e+172, 1.324641819451828974500e+174, 1.443859583202493582205e+176, 1.588245541522742940425e+178, 1.762952551090244663872e+180, 1.974506857221074023537e+182, 2.231192748659813646597e+184, 2.543559733472187557120e+186, 2.925093693493015690688e+188, 3.393108684451898201198e+190, 3.969937160808720895402e+192, 4.684525849754290656574e+194, 5.574585761207605881323e+196, 6.689502913449127057588e+198, 8.094298525273443739682e+200, 9.875044200833601362412e+202, 1.214630436702532967577e+205, 1.506141741511140879795e+207, 1.882677176888926099744e+209, 2.372173242880046885677e+211, 3.012660018457659544810e+213, 3.856204823625804217357e+215, 4.974504222477287440390e+217, 6.466855489220473672507e+219, 8.471580690878820510985e+221, 1.118248651196004307450e+224, 1.487270706090685728908e+226, 1.992942746161518876737e+228, 2.690472707318050483595e+230, 3.659042881952548657690e+232, 5.012888748274991661035e+234, 6.917786472619488492228e+236, 9.615723196941089004197e+238, 1.346201247571752460588e+241, 1.898143759076170969429e+243, 2.695364137888162776589e+245, 3.854370717180072770522e+247, 5.550293832739304789551e+249, 8.047926057471991944849e+251, 1.174997204390910823948e+254, 1.727245890454638911203e+256, 2.556323917872865588581e+258, 3.808922637630569726986e+260, 5.713383956445854590479e+262, 8.627209774233240431623e+264, 1.311335885683452545607e+267, 2.006343905095682394778e+269, 3.089769613847350887959e+271, 4.789142901463393876336e+273, 7.471062926282894447084e+275, 1.172956879426414428192e+278, 1.853271869493734796544e+280, 2.946702272495038326504e+282, 4.714723635992061322407e+284, 7.590705053947218729075e+286, 1.229694218739449434110e+289, 2.004401576545302577600e+291, 3.287218585534296227263e+293, 5.423910666131588774984e+295, 9.003691705778437366474e+297, 1.503616514864999040201e+300, 2.526075744973198387538e+302, 4.269068009004705274939e+304, 7.257415615307998967397e+306})); } { _const_math__log_factorials_table = builtin__new_array_from_c_array(172, 172, sizeof(f64), _MOV((f64[172]){ 0.000000000000000000000e+0, 0.000000000000000000000e+0, 6.931471805599453094172e-1, 1.791759469228055000812e+0, 3.178053830347945619647e+0, 4.787491742782045994248e+0, 6.579251212010100995060e+0, 8.525161361065414300166e+0, 1.060460290274525022842e+1, 1.280182748008146961121e+1, 1.510441257307551529523e+1, 1.750230784587388583929e+1, 1.998721449566188614952e+1, 2.255216385312342288557e+1, 2.519122118273868150009e+1, 2.789927138384089156609e+1, 3.067186010608067280376e+1, 3.350507345013688888401e+1, 3.639544520803305357622e+1, 3.933988418719949403622e+1, 4.233561646075348502966e+1, 4.538013889847690802616e+1, 4.847118135183522387964e+1, 5.160667556776437357045e+1, 5.478472939811231919009e+1, 5.800360522298051993929e+1, 6.126170176100200198477e+1, 6.455753862700633105895e+1, 6.788974313718153498289e+1, 7.125703896716800901007e+1, 7.465823634883016438549e+1, 7.809222355331531063142e+1, 8.155795945611503717850e+1, 8.505446701758151741396e+1, 8.858082754219767880363e+1, 9.213617560368709248333e+1, 9.571969454214320248496e+1, 9.933061245478742692933e+1, 1.029681986145138126988e+2, 1.066317602606434591262e+2, 1.103206397147573954291e+2, 1.140342117814617032329e+2, 1.177718813997450715388e+2, 1.215330815154386339623e+2, 1.253172711493568951252e+2, 1.291239336391272148826e+2, 1.329525750356163098828e+2, 1.368027226373263684696e+2, 1.406739236482342593987e+2, 1.445657439463448860089e+2, 1.484777669517730320675e+2, 1.524095925844973578392e+2, 1.563608363030787851941e+2, 1.603311282166309070282e+2, 1.643201122631951814118e+2, 1.683274454484276523305e+2, 1.723527971391628015638e+2, 1.763958484069973517152e+2, 1.804562914175437710518e+2, 1.845338288614494905025e+2, 1.886281734236715911873e+2, 1.927390472878449024360e+2, 1.968661816728899939914e+2, 2.010093163992815266793e+2, 2.051681994826411985358e+2, 2.093425867525368356464e+2, 2.135322414945632611913e+2, 2.177369341139542272510e+2, 2.219564418191303339501e+2, 2.261905483237275933323e+2, 2.304390435657769523214e+2, 2.347017234428182677427e+2, 2.389783895618343230538e+2, 2.432688490029827141829e+2, 2.475729140961868839366e+2, 2.518904022097231943772e+2, 2.562211355500095254561e+2, 2.605649409718632093053e+2, 2.649216497985528010421e+2, 2.692910976510198225363e+2, 2.736731242856937041486e+2, 2.780675734403661429141e+2, 2.824742926876303960274e+2, 2.868931332954269939509e+2, 2.913239500942703075662e+2, 2.957666013507606240211e+2, 3.002209486470141317540e+2, 3.046868567656687154726e+2, 3.091641935801469219449e+2, 3.136528299498790617832e+2, 3.181526396202093268500e+2, 3.226634991267261768912e+2, 3.271852877037752172008e+2, 3.317178871969284731381e+2, 3.362611819791984770344e+2, 3.408150588707990178690e+2, 3.453794070622668541074e+2, 3.499541180407702369296e+2, 3.545390855194408088492e+2, 3.591342053695753987760e+2, 3.637393755555634901441e+2, 3.683544960724047495950e+2, 3.729794688856890206760e+2, 3.776141978739186564468e+2, 3.822585887730600291111e+2, 3.869125491232175524822e+2, 3.915759882173296196258e+2, 3.962488170517915257991e+2, 4.009309482789157454921e+2, 4.056222961611448891925e+2, 4.103227765269373054205e+2, 4.150323067282496395563e+2, 4.197508055995447340991e+2, 4.244781934182570746677e+2, 4.292143918666515701285e+2, 4.339593239950148201939e+2, 4.387129141861211848399e+2, 4.434750881209189409588e+2, 4.482457727453846057188e+2, 4.530248962384961351041e+2, 4.578123879812781810984e+2, 4.626081785268749221865e+2, 4.674121995716081787447e+2, 4.722243839269805962399e+2, 4.770446654925856331047e+2, 4.818729792298879342285e+2, 4.867092611368394122258e+2, 4.915534482232980034989e+2, 4.964054784872176206648e+2, 5.012652908915792927797e+2, 5.061328253420348751997e+2, 5.110080226652360267439e+2, 5.158908245878223975982e+2, 5.207811737160441513633e+2, 5.256790135159950627324e+2, 5.305842882944334921812e+2, 5.354969431801695441897e+2, 5.404169241059976691050e+2, 5.453441777911548737966e+2, 5.502786517242855655538e+2, 5.552202941468948698523e+2, 5.601690540372730381305e+2, 5.651248810948742988613e+2, 5.700877257251342061414e+2, 5.750575390247102067619e+2, 5.800342727671307811636e+2, 5.850178793888391176022e+2, 5.900083119756178539038e+2, 5.950055242493819689670e+2, 6.000094705553274281080e+2, 6.050201058494236838580e+2, 6.100373856862386081868e+2, 6.150612662070848845750e+2, 6.200917041284773200381e+2, 6.251286567308909491967e+2, 6.301720818478101958172e+2, 6.352219378550597328635e+2, 6.402781836604080409209e+2, 6.453407786934350077245e+2, 6.504096828956552392500e+2, 6.554848567108890661717e+2, 6.605662610758735291676e+2, 6.656538574111059132426e+2, 6.707476076119126755767e+2, 6.758474740397368739994e+2, 6.809534195136374546094e+2, 6.860654073019939978423e+2, 6.911834011144107529496e+2, 6.963073650938140118743e+2, 7.014372638087370853465e+2, 7.065730622457873471107e+2, 7.117147258022900069535e+2})); } _const_math__gamma_p = builtin__new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){1.60119522476751861407e-04, 1.19135147006586384913e-03, 1.04213797561761569935e-02, 4.76367800457137231464e-02, 2.07448227648435975150e-01, 4.94214826801497100753e-01, 9.99999999999999996796e-01})); _const_math__gamma_q = builtin__new_array_from_c_array(8, 8, sizeof(f64), _MOV((f64[8]){-2.31581873324120129819e-05, 5.39605580493303397842e-04, -4.45641913851797240494e-03, 1.18139785222060435552e-02, 3.58236398605498653373e-02, -2.34591795718243348568e-01, 7.14304917030273074085e-02, 1.00000000000000000320e+00})); _const_math__gamma_s = builtin__new_array_from_c_array(5, 5, sizeof(f64), _MOV((f64[5]){7.87311395793093628397e-04, -2.29549961613378126380e-04, -2.68132617805781232825e-03, 3.47222221605458667310e-03, 8.33333333333482257126e-02})); { _const_math__lgamma_a = builtin__new_array_from_c_array(12, 12, sizeof(f64), _MOV((f64[12]){ 7.72156649015328655494e-02, 3.22467033424113591611e-01, 6.73523010531292681824e-02, 2.05808084325167332806e-02, 7.38555086081402883957e-03, 2.89051383673415629091e-03, 1.19270763183362067845e-03, 5.10069792153511336608e-04, 2.20862790713908385557e-04, 1.08011567247583939954e-04, 2.52144565451257326939e-05, 4.48640949618915160150e-05})); } _const_math__lgamma_r = builtin__new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){1.0, 1.39200533467621045958e+00, 7.21935547567138069525e-01, 1.71933865632803078993e-01, 1.86459191715652901344e-02, 7.77942496381893596434e-04, 7.32668430744625636189e-06})); _const_math__lgamma_s = builtin__new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){-7.72156649015328655494e-02, 2.14982415960608852501e-01, 3.25778796408930981787e-01, 1.46350472652464452805e-01, 2.66422703033638609560e-02, 1.84028451407337715652e-03, 3.19475326584100867617e-05})); { _const_math__lgamma_t = builtin__new_array_from_c_array(15, 15, sizeof(f64), _MOV((f64[15]){ 4.83836122723810047042e-01, -1.47587722994593911752e-01, 6.46249402391333854778e-02, -3.27885410759859649565e-02, 1.79706750811820387126e-02, -1.03142241298341437450e-02, 6.10053870246291332635e-03, -3.68452016781138256760e-03, 2.25964780900612472250e-03, -1.40346469989232843813e-03, 8.81081882437654011382e-04, -5.38595305356740546715e-04, 3.15632070903625950361e-04, -3.12754168375120860518e-04, 3.35529192635519073543e-04})); } _const_math__lgamma_u = builtin__new_array_from_c_array(6, 6, sizeof(f64), _MOV((f64[6]){-7.72156649015328655494e-02, 6.32827064025093366517e-01, 1.45492250137234768737e+00, 9.77717527963372745603e-01, 2.28963728064692451092e-01, 1.33810918536787660377e-02})); _const_math__lgamma_v = builtin__new_array_from_c_array(6, 6, sizeof(f64), _MOV((f64[6]){1.0, 2.45597793713041134822e+00, 2.12848976379893395361e+00, 7.69285150456672783825e-01, 1.04222645593369134254e-01, 3.21709242282423911810e-03})); _const_math__lgamma_w = builtin__new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){4.18938533204672725052e-01, 8.33333333333329678849e-02, -2.77777777728775536470e-03, 7.93650558643019558500e-04, -5.95187557450339963135e-04, 8.36339918996282139126e-04, -1.63092934096575273989e-03})); { _const_math__pow10tab = builtin__new_array_from_c_array(32, 32, sizeof(f64), _MOV((f64[32]){ ((f64)(1e+00)), 1e+01, 1e+02, 1e+03, 1e+04, 1e+05, 1e+06, 1e+07, 1e+08, 1e+09, 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, 1e+17, 1e+18, 1e+19, 1e+20, 1e+21, 1e+22, 1e+23, 1e+24, 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, 1e+31})); } { _const_math__pow10postab32 = builtin__new_array_from_c_array(10, 10, sizeof(f64), _MOV((f64[10]){ ((f64)(1e+00)), 1e+32, 1e+64, 1e+96, 1e+128, 1e+160, 1e+192, 1e+224, 1e+256, 1e+288})); } { _const_math__pow10negtab32 = builtin__new_array_from_c_array(11, 11, sizeof(f64), _MOV((f64[11]){ ((f64)(1e-00)), 1e-32, 1e-64, 1e-96, 1e-128, 1e-160, 1e-192, 1e-224, 1e-256, 1e-288, 1e-320})); } { _const_math__sin_data = builtin__new_array_from_c_array(12, 12, sizeof(f64), _MOV((f64[12]){ -0.3295190160663511504173, 0.0025374284671667991990, 0.0006261928782647355874, -4.6495547521854042157541e-06, -5.6917531549379706526677e-07, 3.7283335140973803627866e-09, 3.0267376484747473727186e-10, -1.7400875016436622322022e-12, -1.0554678305790849834462e-13, 5.3701981409132410797062e-16, 2.5984137983099020336115e-17, -1.1821555255364833468288e-19})); } { _const_math__cos_data = builtin__new_array_from_c_array(11, 11, sizeof(f64), _MOV((f64[11]){ 0.165391825637921473505668118136, -0.00084852883845000173671196530195, -0.000210086507222940730213625768083, 1.16582269619760204299639757584e-6, 1.43319375856259870334412701165e-7, -7.4770883429007141617951330184e-10, -6.0969994944584252706997438007e-11, 2.90748249201909353949854872638e-13, 1.77126739876261435667156490461e-14, -7.6896421502815579078577263149e-17, -3.7363121133079412079201377318e-18})); } _const_math__tan_p = builtin__new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){-1.30936939181383777646e+4, 1.15351664838587416140e+6, -1.79565251976484877988e+7})); _const_math__tan_q = builtin__new_array_from_c_array(5, 5, sizeof(f64), _MOV((f64[5]){1.00000000000000000000e+0, 1.36812963470692954678e+4, -1.32089234440210967447e+6, 2.50083801823357915839e+7, -5.38695755929454629881e+7})); _const_math__tanh_p = builtin__new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){-9.64399179425052238628e-1, -9.92877231001918586564e+1, -1.61468768441708447952e+3})); _const_math__tanh_q = builtin__new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){1.12811678491632931402e+2, 2.23548839060100448583e+3, 4.84406305325125486048e+3})); { { _const_math__sin_cs = ((math__ChebSeries){.c = _const_math__sin_data,.order = 11,.a = -1,.b = 1,}); } } { { _const_math__cos_cs = ((math__ChebSeries){.c = _const_math__cos_data,.order = 10,.a = -1,.b = 1,}); } } } void _vcleanup(void) { static bool once = false; if (once) {return;} once = true; } __attribute__ ((constructor)) void _vinit_caller() { static bool once = false; if (once) {return;} once = true; _vinit(0,0); } __attribute__ ((destructor)) void _vcleanup_caller() { static bool once = false; if (once) {return;} once = true; _vcleanup(); } int main(int ___argc, char** ___argv){ g_main_argc = ___argc; g_main_argv = ___argv; _vinit(___argc, (voidptr)___argv); main__main(); _vcleanup(); return 0; } // THE END.