koffi 0.9.1 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CMakeLists.txt +2 -36
- package/package.json +3 -3
- package/vendor/dragonbox/CMakeLists.txt +123 -0
- package/vendor/dragonbox/LICENSE-Apache2-LLVM +218 -0
- package/vendor/dragonbox/LICENSE-Boost +23 -0
- package/vendor/dragonbox/README.md +277 -0
- package/vendor/dragonbox/cmake/dragonboxConfig.cmake +1 -0
- package/vendor/dragonbox/include/dragonbox/dragonbox.h +2670 -0
- package/vendor/dragonbox/include/dragonbox/dragonbox_to_chars.h +108 -0
- package/vendor/dragonbox/other_files/Dragonbox.pdf +0 -0
- package/vendor/dragonbox/other_files/Dragonbox_old.pdf +0 -0
- package/vendor/dragonbox/other_files/milo_benchmark.png +0 -0
- package/vendor/dragonbox/other_files/unknown_win64_vc2019.html +540 -0
- package/vendor/dragonbox/other_files/unknown_win64_vc2019_randomdigit_time.png +0 -0
- package/vendor/dragonbox/source/dragonbox_to_chars.cpp +303 -0
- package/vendor/dragonbox/subproject/3rdparty/grisu_exact/CMakeLists.txt +24 -0
- package/vendor/dragonbox/subproject/3rdparty/grisu_exact/fp_to_chars.cpp +238 -0
- package/vendor/dragonbox/subproject/3rdparty/grisu_exact/fp_to_chars.h +95 -0
- package/vendor/dragonbox/subproject/3rdparty/grisu_exact/grisu_exact.h +2666 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/CMakeLists.txt +16 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/common.h +114 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s.c +509 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s_full_table.h +367 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s_intrinsics.h +357 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/digit_table.h +35 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s.c +345 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s_full_table.h +55 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s_intrinsics.h +128 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/ryu.h +46 -0
- package/vendor/dragonbox/subproject/3rdparty/schubfach/CMakeLists.txt +22 -0
- package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_32.cc +699 -0
- package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_32.h +31 -0
- package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_64.cc +1354 -0
- package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_64.h +31 -0
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/example_shaded_plots.m +68 -0
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/license.txt +25 -0
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_distribution.m +92 -0
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_distribution_prctile.m +121 -0
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_histogram_shaded.m +99 -0
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_shaded.m +93 -0
- package/vendor/dragonbox/subproject/benchmark/CMakeLists.txt +65 -0
- package/vendor/dragonbox/subproject/benchmark/include/benchmark.h +40 -0
- package/vendor/dragonbox/subproject/benchmark/matlab/plot_benchmarks.m +22 -0
- package/vendor/dragonbox/subproject/benchmark/matlab/plot_digit_benchmark.m +78 -0
- package/vendor/dragonbox/subproject/benchmark/matlab/plot_uniform_benchmark.m +95 -0
- package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary32_clang.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary32_msvc.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary64_clang.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary64_msvc.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary32_clang.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary32_msvc.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary64_clang.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary64_msvc.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/source/benchmark.cpp +238 -0
- package/vendor/dragonbox/subproject/benchmark/source/dragonbox.cpp +30 -0
- package/vendor/dragonbox/subproject/benchmark/source/grisu_exact.cpp +36 -0
- package/vendor/dragonbox/subproject/benchmark/source/ryu.cpp +27 -0
- package/vendor/dragonbox/subproject/benchmark/source/schubfach.cpp +31 -0
- package/vendor/dragonbox/subproject/common/CMakeLists.txt +42 -0
- package/vendor/dragonbox/subproject/common/include/best_rational_approx.h +97 -0
- package/vendor/dragonbox/subproject/common/include/big_uint.h +218 -0
- package/vendor/dragonbox/subproject/common/include/continued_fractions.h +174 -0
- package/vendor/dragonbox/subproject/common/include/good_rational_approx.h +267 -0
- package/vendor/dragonbox/subproject/common/include/random_float.h +182 -0
- package/vendor/dragonbox/subproject/common/include/rational_continued_fractions.h +57 -0
- package/vendor/dragonbox/subproject/common/source/big_uint.cpp +602 -0
- package/vendor/dragonbox/subproject/meta/CMakeLists.txt +41 -0
- package/vendor/dragonbox/subproject/meta/results/binary32_generated_cache.txt +82 -0
- package/vendor/dragonbox/subproject/meta/results/binary64_compressed_cache_error_table.txt +10 -0
- package/vendor/dragonbox/subproject/meta/results/binary64_generated_cache.txt +623 -0
- package/vendor/dragonbox/subproject/meta/source/generate_cache.cpp +126 -0
- package/vendor/dragonbox/subproject/meta/source/live_test.cpp +81 -0
- package/vendor/dragonbox/subproject/meta/source/perf_test.cpp +104 -0
- package/vendor/dragonbox/subproject/meta/source/sandbox.cpp +20 -0
- package/vendor/dragonbox/subproject/test/CMakeLists.txt +70 -0
- package/vendor/dragonbox/subproject/test/results/binary32.csv +255 -0
- package/vendor/dragonbox/subproject/test/results/binary64.csv +2047 -0
- package/vendor/dragonbox/subproject/test/results/plot_required_bits.m +18 -0
- package/vendor/dragonbox/subproject/test/source/test_all_shorter_interval_cases.cpp +88 -0
- package/vendor/dragonbox/subproject/test/source/uniform_random_test.cpp +95 -0
- package/vendor/dragonbox/subproject/test/source/verify_cache_precision.cpp +338 -0
- package/vendor/dragonbox/subproject/test/source/verify_compressed_cache.cpp +154 -0
- package/vendor/dragonbox/subproject/test/source/verify_fast_multiplication.cpp +168 -0
- package/vendor/dragonbox/subproject/test/source/verify_log_computation.cpp +251 -0
- package/vendor/dragonbox/subproject/test/source/verify_magic_division.cpp +113 -0
- package/vendor/libcc/libcc.cc +7651 -0
- package/vendor/libcc/libcc.hh +4312 -0
- package/vendor/node-addon-api/CHANGELOG.md +859 -0
- package/vendor/node-addon-api/CODE_OF_CONDUCT.md +4 -0
- package/vendor/node-addon-api/CONTRIBUTING.md +93 -0
- package/vendor/node-addon-api/LICENSE.md +13 -0
- package/vendor/node-addon-api/README.md +293 -0
- package/vendor/node-addon-api/appveyor.yml +37 -0
- package/vendor/node-addon-api/benchmark/README.md +47 -0
- package/vendor/node-addon-api/benchmark/binding.gyp +25 -0
- package/vendor/node-addon-api/benchmark/function_args.cc +217 -0
- package/vendor/node-addon-api/benchmark/function_args.js +60 -0
- package/vendor/node-addon-api/benchmark/index.js +34 -0
- package/vendor/node-addon-api/benchmark/property_descriptor.cc +91 -0
- package/vendor/node-addon-api/benchmark/property_descriptor.js +37 -0
- package/vendor/node-addon-api/common.gypi +21 -0
- package/vendor/node-addon-api/doc/addon.md +163 -0
- package/vendor/node-addon-api/doc/array.md +81 -0
- package/vendor/node-addon-api/doc/array_buffer.md +155 -0
- package/vendor/node-addon-api/doc/async_context.md +86 -0
- package/vendor/node-addon-api/doc/async_operations.md +31 -0
- package/vendor/node-addon-api/doc/async_worker.md +427 -0
- package/vendor/node-addon-api/doc/async_worker_variants.md +557 -0
- package/vendor/node-addon-api/doc/bigint.md +97 -0
- package/vendor/node-addon-api/doc/boolean.md +68 -0
- package/vendor/node-addon-api/doc/buffer.md +150 -0
- package/vendor/node-addon-api/doc/callback_scope.md +54 -0
- package/vendor/node-addon-api/doc/callbackinfo.md +97 -0
- package/vendor/node-addon-api/doc/checker-tool.md +32 -0
- package/vendor/node-addon-api/doc/class_property_descriptor.md +115 -0
- package/vendor/node-addon-api/doc/cmake-js.md +68 -0
- package/vendor/node-addon-api/doc/conversion-tool.md +28 -0
- package/vendor/node-addon-api/doc/creating_a_release.md +62 -0
- package/vendor/node-addon-api/doc/dataview.md +248 -0
- package/vendor/node-addon-api/doc/date.md +68 -0
- package/vendor/node-addon-api/doc/env.md +196 -0
- package/vendor/node-addon-api/doc/error.md +120 -0
- package/vendor/node-addon-api/doc/error_handling.md +254 -0
- package/vendor/node-addon-api/doc/escapable_handle_scope.md +80 -0
- package/vendor/node-addon-api/doc/external.md +63 -0
- package/vendor/node-addon-api/doc/function.md +402 -0
- package/vendor/node-addon-api/doc/function_reference.md +238 -0
- package/vendor/node-addon-api/doc/generator.md +13 -0
- package/vendor/node-addon-api/doc/handle_scope.md +63 -0
- package/vendor/node-addon-api/doc/hierarchy.md +91 -0
- package/vendor/node-addon-api/doc/instance_wrap.md +408 -0
- package/vendor/node-addon-api/doc/maybe.md +76 -0
- package/vendor/node-addon-api/doc/memory_management.md +27 -0
- package/vendor/node-addon-api/doc/name.md +29 -0
- package/vendor/node-addon-api/doc/node-gyp.md +82 -0
- package/vendor/node-addon-api/doc/number.md +163 -0
- package/vendor/node-addon-api/doc/object.md +432 -0
- package/vendor/node-addon-api/doc/object_lifetime_management.md +83 -0
- package/vendor/node-addon-api/doc/object_reference.md +117 -0
- package/vendor/node-addon-api/doc/object_wrap.md +561 -0
- package/vendor/node-addon-api/doc/prebuild_tools.md +16 -0
- package/vendor/node-addon-api/doc/promises.md +79 -0
- package/vendor/node-addon-api/doc/property_descriptor.md +286 -0
- package/vendor/node-addon-api/doc/propertylvalue.md +50 -0
- package/vendor/node-addon-api/doc/range_error.md +59 -0
- package/vendor/node-addon-api/doc/reference.md +113 -0
- package/vendor/node-addon-api/doc/setup.md +110 -0
- package/vendor/node-addon-api/doc/string.md +93 -0
- package/vendor/node-addon-api/doc/symbol.md +61 -0
- package/vendor/node-addon-api/doc/threadsafe.md +121 -0
- package/vendor/node-addon-api/doc/threadsafe_function.md +290 -0
- package/vendor/node-addon-api/doc/type_error.md +59 -0
- package/vendor/node-addon-api/doc/typed_array.md +78 -0
- package/vendor/node-addon-api/doc/typed_array_of.md +137 -0
- package/vendor/node-addon-api/doc/typed_threadsafe_function.md +306 -0
- package/vendor/node-addon-api/doc/value.md +340 -0
- package/vendor/node-addon-api/doc/version_management.md +43 -0
- package/vendor/node-addon-api/except.gypi +25 -0
- package/vendor/node-addon-api/index.js +11 -0
- package/vendor/node-addon-api/napi-inl.deprecated.h +192 -0
- package/vendor/node-addon-api/napi-inl.h +6209 -0
- package/vendor/node-addon-api/napi.h +2983 -0
- package/vendor/node-addon-api/node_api.gyp +9 -0
- package/vendor/node-addon-api/noexcept.gypi +26 -0
- package/vendor/node-addon-api/nothing.c +0 -0
- package/vendor/node-addon-api/package-support.json +21 -0
- package/vendor/node-addon-api/package.json +399 -0
- package/vendor/node-addon-api/test/README.md +91 -0
- package/vendor/node-addon-api/test/addon.cc +36 -0
- package/vendor/node-addon-api/test/addon.js +11 -0
- package/vendor/node-addon-api/test/addon_build/index.js +49 -0
- package/vendor/node-addon-api/test/addon_build/tpl/addon.cc +17 -0
- package/vendor/node-addon-api/test/addon_build/tpl/binding.gyp +62 -0
- package/vendor/node-addon-api/test/addon_build/tpl/index.js +9 -0
- package/vendor/node-addon-api/test/addon_build/tpl/package.json +11 -0
- package/vendor/node-addon-api/test/addon_data.cc +99 -0
- package/vendor/node-addon-api/test/addon_data.js +46 -0
- package/vendor/node-addon-api/test/array_buffer.cc +243 -0
- package/vendor/node-addon-api/test/array_buffer.js +69 -0
- package/vendor/node-addon-api/test/async_context.cc +21 -0
- package/vendor/node-addon-api/test/async_context.js +86 -0
- package/vendor/node-addon-api/test/async_progress_queue_worker.cc +83 -0
- package/vendor/node-addon-api/test/async_progress_queue_worker.js +46 -0
- package/vendor/node-addon-api/test/async_progress_worker.cc +134 -0
- package/vendor/node-addon-api/test/async_progress_worker.js +61 -0
- package/vendor/node-addon-api/test/async_worker.cc +106 -0
- package/vendor/node-addon-api/test/async_worker.js +179 -0
- package/vendor/node-addon-api/test/async_worker_nocallback.js +13 -0
- package/vendor/node-addon-api/test/async_worker_persistent.cc +63 -0
- package/vendor/node-addon-api/test/async_worker_persistent.js +24 -0
- package/vendor/node-addon-api/test/basic_types/array.cc +40 -0
- package/vendor/node-addon-api/test/basic_types/array.js +35 -0
- package/vendor/node-addon-api/test/basic_types/boolean.cc +38 -0
- package/vendor/node-addon-api/test/basic_types/boolean.js +35 -0
- package/vendor/node-addon-api/test/basic_types/number.cc +99 -0
- package/vendor/node-addon-api/test/basic_types/number.js +114 -0
- package/vendor/node-addon-api/test/basic_types/value.cc +120 -0
- package/vendor/node-addon-api/test/basic_types/value.js +133 -0
- package/vendor/node-addon-api/test/bigint.cc +91 -0
- package/vendor/node-addon-api/test/bigint.js +53 -0
- package/vendor/node-addon-api/test/binding-swallowexcept.cc +12 -0
- package/vendor/node-addon-api/test/binding.cc +171 -0
- package/vendor/node-addon-api/test/binding.gyp +117 -0
- package/vendor/node-addon-api/test/buffer.cc +183 -0
- package/vendor/node-addon-api/test/buffer.js +69 -0
- package/vendor/node-addon-api/test/callbackscope.cc +22 -0
- package/vendor/node-addon-api/test/callbackscope.js +49 -0
- package/vendor/node-addon-api/test/common/index.js +113 -0
- package/vendor/node-addon-api/test/common/test_helper.h +61 -0
- package/vendor/node-addon-api/test/dataview/dataview.cc +48 -0
- package/vendor/node-addon-api/test/dataview/dataview.js +35 -0
- package/vendor/node-addon-api/test/dataview/dataview_read_write.cc +115 -0
- package/vendor/node-addon-api/test/dataview/dataview_read_write.js +90 -0
- package/vendor/node-addon-api/test/date.cc +44 -0
- package/vendor/node-addon-api/test/date.js +18 -0
- package/vendor/node-addon-api/test/env_cleanup.cc +88 -0
- package/vendor/node-addon-api/test/env_cleanup.js +56 -0
- package/vendor/node-addon-api/test/error.cc +287 -0
- package/vendor/node-addon-api/test/error.js +81 -0
- package/vendor/node-addon-api/test/error_handling_for_primitives.cc +13 -0
- package/vendor/node-addon-api/test/error_handling_for_primitives.js +29 -0
- package/vendor/node-addon-api/test/error_terminating_environment.js +94 -0
- package/vendor/node-addon-api/test/external.cc +81 -0
- package/vendor/node-addon-api/test/external.js +88 -0
- package/vendor/node-addon-api/test/function.cc +295 -0
- package/vendor/node-addon-api/test/function.js +121 -0
- package/vendor/node-addon-api/test/function_reference.cc +202 -0
- package/vendor/node-addon-api/test/function_reference.js +157 -0
- package/vendor/node-addon-api/test/globalObject/global_object.cc +61 -0
- package/vendor/node-addon-api/test/globalObject/global_object_delete_property.cc +31 -0
- package/vendor/node-addon-api/test/globalObject/global_object_delete_property.js +61 -0
- package/vendor/node-addon-api/test/globalObject/global_object_get_property.cc +40 -0
- package/vendor/node-addon-api/test/globalObject/global_object_get_property.js +57 -0
- package/vendor/node-addon-api/test/globalObject/global_object_has_own_property.cc +28 -0
- package/vendor/node-addon-api/test/globalObject/global_object_has_own_property.js +48 -0
- package/vendor/node-addon-api/test/globalObject/global_object_set_property.cc +31 -0
- package/vendor/node-addon-api/test/globalObject/global_object_set_property.js +58 -0
- package/vendor/node-addon-api/test/handlescope.cc +60 -0
- package/vendor/node-addon-api/test/handlescope.js +14 -0
- package/vendor/node-addon-api/test/index.js +136 -0
- package/vendor/node-addon-api/test/maybe/check.cc +23 -0
- package/vendor/node-addon-api/test/maybe/index.js +38 -0
- package/vendor/node-addon-api/test/memory_management.cc +17 -0
- package/vendor/node-addon-api/test/memory_management.js +9 -0
- package/vendor/node-addon-api/test/movable_callbacks.cc +23 -0
- package/vendor/node-addon-api/test/movable_callbacks.js +21 -0
- package/vendor/node-addon-api/test/name.cc +108 -0
- package/vendor/node-addon-api/test/name.js +59 -0
- package/vendor/node-addon-api/test/napi_child.js +14 -0
- package/vendor/node-addon-api/test/object/delete_property.cc +38 -0
- package/vendor/node-addon-api/test/object/delete_property.js +41 -0
- package/vendor/node-addon-api/test/object/finalizer.cc +29 -0
- package/vendor/node-addon-api/test/object/finalizer.js +28 -0
- package/vendor/node-addon-api/test/object/get_property.cc +34 -0
- package/vendor/node-addon-api/test/object/get_property.js +40 -0
- package/vendor/node-addon-api/test/object/has_own_property.cc +34 -0
- package/vendor/node-addon-api/test/object/has_own_property.js +34 -0
- package/vendor/node-addon-api/test/object/has_property.cc +38 -0
- package/vendor/node-addon-api/test/object/has_property.js +37 -0
- package/vendor/node-addon-api/test/object/object.cc +348 -0
- package/vendor/node-addon-api/test/object/object.js +217 -0
- package/vendor/node-addon-api/test/object/object_deprecated.cc +66 -0
- package/vendor/node-addon-api/test/object/object_deprecated.js +47 -0
- package/vendor/node-addon-api/test/object/object_freeze_seal.cc +25 -0
- package/vendor/node-addon-api/test/object/object_freeze_seal.js +61 -0
- package/vendor/node-addon-api/test/object/set_property.cc +37 -0
- package/vendor/node-addon-api/test/object/set_property.js +29 -0
- package/vendor/node-addon-api/test/object/subscript_operator.cc +42 -0
- package/vendor/node-addon-api/test/object/subscript_operator.js +17 -0
- package/vendor/node-addon-api/test/object_reference.cc +219 -0
- package/vendor/node-addon-api/test/object_reference.js +259 -0
- package/vendor/node-addon-api/test/objectwrap.cc +268 -0
- package/vendor/node-addon-api/test/objectwrap.js +284 -0
- package/vendor/node-addon-api/test/objectwrap_constructor_exception.cc +26 -0
- package/vendor/node-addon-api/test/objectwrap_constructor_exception.js +18 -0
- package/vendor/node-addon-api/test/objectwrap_multiple_inheritance.cc +30 -0
- package/vendor/node-addon-api/test/objectwrap_multiple_inheritance.js +13 -0
- package/vendor/node-addon-api/test/objectwrap_removewrap.cc +45 -0
- package/vendor/node-addon-api/test/objectwrap_removewrap.js +40 -0
- package/vendor/node-addon-api/test/objectwrap_worker_thread.js +19 -0
- package/vendor/node-addon-api/test/promise.cc +29 -0
- package/vendor/node-addon-api/test/promise.js +18 -0
- package/vendor/node-addon-api/test/reference.cc +24 -0
- package/vendor/node-addon-api/test/reference.js +14 -0
- package/vendor/node-addon-api/test/run_script.cc +56 -0
- package/vendor/node-addon-api/test/run_script.js +45 -0
- package/vendor/node-addon-api/test/symbol.cc +79 -0
- package/vendor/node-addon-api/test/symbol.js +73 -0
- package/vendor/node-addon-api/test/testUtil.js +54 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function.cc +195 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function.js +188 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_ctx.cc +63 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_ctx.js +12 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_existing_tsfn.cc +115 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_existing_tsfn.js +14 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_ptr.cc +26 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_ptr.js +7 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_sum.cc +225 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_sum.js +59 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_unref.cc +42 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_unref.js +53 -0
- package/vendor/node-addon-api/test/thunking_manual.cc +140 -0
- package/vendor/node-addon-api/test/thunking_manual.js +17 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function.cc +215 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function.js +188 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_ctx.cc +68 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_ctx.js +12 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_existing_tsfn.cc +127 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_existing_tsfn.js +14 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_ptr.cc +28 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_ptr.js +7 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_sum.cc +237 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_sum.js +59 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_unref.cc +53 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_unref.js +53 -0
- package/vendor/node-addon-api/test/typedarray-bigint.js +58 -0
- package/vendor/node-addon-api/test/typedarray.cc +216 -0
- package/vendor/node-addon-api/test/typedarray.js +69 -0
- package/vendor/node-addon-api/test/version_management.cc +27 -0
- package/vendor/node-addon-api/test/version_management.js +31 -0
- package/vendor/node-addon-api/tools/README.md +73 -0
- package/vendor/node-addon-api/tools/check-napi.js +100 -0
- package/vendor/node-addon-api/tools/clang-format.js +68 -0
- package/vendor/node-addon-api/tools/conversion.js +309 -0
- package/vendor/node-addon-api/tools/eslint-format.js +71 -0
- package/build/ALL_BUILD.vcxproj +0 -190
- package/build/ALL_BUILD.vcxproj.filters +0 -8
- package/build/CMakeCache.txt +0 -429
- package/build/CMakeFiles/3.23.0-rc1/CMakeASMCompiler.cmake +0 -20
- package/build/CMakeFiles/3.23.0-rc1/CMakeASM_MASMCompiler.cmake +0 -20
- package/build/CMakeFiles/3.23.0-rc1/CMakeCCompiler.cmake +0 -72
- package/build/CMakeFiles/3.23.0-rc1/CMakeCXXCompiler.cmake +0 -83
- package/build/CMakeFiles/3.23.0-rc1/CMakeDetermineCompilerABI_C.bin +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CMakeDetermineCompilerABI_CXX.bin +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CMakeRCCompiler.cmake +0 -6
- package/build/CMakeFiles/3.23.0-rc1/CMakeSystem.cmake +0 -15
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/CMakeCCompilerId.c +0 -828
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/CompilerIdC.exe +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/CompilerIdC.vcxproj +0 -71
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CMakeCCompilerId.obj +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.exe.recipe +0 -11
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/CL.command.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/CL.read.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/CL.write.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/CompilerIdC.lastbuildstate +0 -2
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/link.command.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/link.read.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/link.write.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/CMakeCXXCompilerId.cpp +0 -816
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/CompilerIdCXX.exe +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/CompilerIdCXX.vcxproj +0 -71
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CMakeCXXCompilerId.obj +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.exe.recipe +0 -11
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.command.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.read.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.write.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CompilerIdCXX.lastbuildstate +0 -2
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.command.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.read.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.write.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/VCTargetsPath.txt +0 -1
- package/build/CMakeFiles/3.23.0-rc1/VCTargetsPath.vcxproj +0 -31
- package/build/CMakeFiles/3.23.0-rc1/x64/Debug/VCTargetsPath.recipe +0 -11
- package/build/CMakeFiles/3.23.0-rc1/x64/Debug/VCTargetsPath.tlog/VCTargetsPath.lastbuildstate +0 -2
- package/build/CMakeFiles/41bcd16856091d4a38fd1f71fbe2f202/generate.stamp.rule +0 -1
- package/build/CMakeFiles/CMakeError.log +0 -108
- package/build/CMakeFiles/CMakeOutput.log +0 -413
- package/build/CMakeFiles/TargetDirectories.txt +0 -4
- package/build/CMakeFiles/cmake.check_cache +0 -1
- package/build/CMakeFiles/generate.stamp +0 -1
- package/build/CMakeFiles/generate.stamp.depend +0 -28
- package/build/CMakeFiles/generate.stamp.list +0 -1
- package/build/Raylib.dir/Release/Raylib.dll.recipe +0 -14
- package/build/Raylib.dir/Release/Raylib.tlog/CL.command.1.tlog +0 -0
- package/build/Raylib.dir/Release/Raylib.tlog/CL.read.1.tlog +0 -0
- package/build/Raylib.dir/Release/Raylib.tlog/CL.write.1.tlog +0 -0
- package/build/Raylib.dir/Release/Raylib.tlog/CustomBuild.command.1.tlog +0 -10
- package/build/Raylib.dir/Release/Raylib.tlog/CustomBuild.read.1.tlog +0 -27
- package/build/Raylib.dir/Release/Raylib.tlog/CustomBuild.write.1.tlog +0 -2
- package/build/Raylib.dir/Release/Raylib.tlog/Raylib.lastbuildstate +0 -2
- package/build/Raylib.dir/Release/Raylib.tlog/Raylib.write.1u.tlog +0 -0
- package/build/Raylib.dir/Release/Raylib.tlog/link.command.1.tlog +0 -0
- package/build/Raylib.dir/Release/Raylib.tlog/link.read.1.tlog +0 -0
- package/build/Raylib.dir/Release/Raylib.tlog/link.write.1.tlog +0 -0
- package/build/Raylib.dir/Release/raudio.obj +0 -0
- package/build/Raylib.dir/Release/rcore.obj +0 -0
- package/build/Raylib.dir/Release/rglfw.obj +0 -0
- package/build/Raylib.dir/Release/rmodels.obj +0 -0
- package/build/Raylib.dir/Release/rshapes.obj +0 -0
- package/build/Raylib.dir/Release/rtext.obj +0 -0
- package/build/Raylib.dir/Release/rtextures.obj +0 -0
- package/build/Raylib.dir/Release/utils.obj +0 -0
- package/build/Raylib.vcxproj +0 -358
- package/build/Raylib.vcxproj.filters +0 -37
- package/build/Release/Raylib.dll +0 -0
- package/build/Release/Raylib.exp +0 -0
- package/build/Release/Raylib.lib +0 -0
- package/build/Release/koffi.exp +0 -0
- package/build/Release/koffi.lib +0 -0
- package/build/Release/koffi.node +0 -0
- package/build/ZERO_CHECK.vcxproj +0 -176
- package/build/ZERO_CHECK.vcxproj.filters +0 -13
- package/build/cmake_install.cmake +0 -44
- package/build/koffi.dir/Release/call_arm64.obj +0 -0
- package/build/koffi.dir/Release/call_x64_sysv.obj +0 -0
- package/build/koffi.dir/Release/call_x64_win.obj +0 -0
- package/build/koffi.dir/Release/call_x64_win_fwd.obj +0 -0
- package/build/koffi.dir/Release/call_x86.obj +0 -0
- package/build/koffi.dir/Release/ffi.obj +0 -0
- package/build/koffi.dir/Release/koffi.node.recipe +0 -14
- package/build/koffi.dir/Release/koffi.tlog/CL.command.1.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/CL.read.1.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/CL.write.1.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/CustomBuild.command.1.tlog +0 -10
- package/build/koffi.dir/Release/koffi.tlog/CustomBuild.read.1.tlog +0 -27
- package/build/koffi.dir/Release/koffi.tlog/CustomBuild.write.1.tlog +0 -2
- package/build/koffi.dir/Release/koffi.tlog/Masm.read.1u.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/Masm.write.1u.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/koffi.lastbuildstate +0 -2
- package/build/koffi.dir/Release/koffi.tlog/koffi.write.1u.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/link.command.1.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/link.read.1.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/link.write.1.tlog +0 -0
- package/build/koffi.dir/Release/libcc.obj +0 -0
- package/build/koffi.dir/Release/util.obj +0 -0
- package/build/koffi.dir/Release/win_delay_load_hook.obj +0 -0
- package/build/koffi.sln +0 -67
- package/build/koffi.vcxproj +0 -363
- package/build/koffi.vcxproj.filters +0 -40
- package/build/x64/Release/ALL_BUILD/ALL_BUILD.recipe +0 -20
- package/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/ALL_BUILD.lastbuildstate +0 -2
- package/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.command.1.tlog +0 -10
- package/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.read.1.tlog +0 -27
- package/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.write.1.tlog +0 -2
- package/build/x64/Release/ZERO_CHECK/ZERO_CHECK.recipe +0 -11
- package/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.command.1.tlog +0 -10
- package/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.read.1.tlog +0 -28
- package/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.write.1.tlog +0 -2
- package/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/ZERO_CHECK.lastbuildstate +0 -2
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Copyright 2020-2022 Junekey Jeon
|
|
2
|
+
//
|
|
3
|
+
// The contents of this file may be used under the terms of
|
|
4
|
+
// the Apache License v2.0 with LLVM Exceptions.
|
|
5
|
+
//
|
|
6
|
+
// (See accompanying file LICENSE-Apache or copy at
|
|
7
|
+
// https://llvm.org/foundation/relicensing/LICENSE.txt)
|
|
8
|
+
//
|
|
9
|
+
// Alternatively, the contents of this file may be used under the terms of
|
|
10
|
+
// the Boost Software License, Version 1.0.
|
|
11
|
+
// (See accompanying file LICENSE-Boost or copy at
|
|
12
|
+
// https://www.boost.org/LICENSE_1_0.txt)
|
|
13
|
+
//
|
|
14
|
+
// Unless required by applicable law or agreed to in writing, this software
|
|
15
|
+
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
// KIND, either express or implied.
|
|
17
|
+
|
|
18
|
+
#include "big_uint.h"
|
|
19
|
+
#include "continued_fractions.h"
|
|
20
|
+
#include "dragonbox/dragonbox.h"
|
|
21
|
+
#include <algorithm>
|
|
22
|
+
#include <utility>
|
|
23
|
+
#include <stdexcept>
|
|
24
|
+
#include <vector>
|
|
25
|
+
|
|
26
|
+
template <class FloatTraits>
|
|
27
|
+
auto generate_cache() {
|
|
28
|
+
using impl = jkj::dragonbox::detail::impl<typename FloatTraits::type, FloatTraits>;
|
|
29
|
+
|
|
30
|
+
std::vector<jkj::big_uint> results;
|
|
31
|
+
jkj::unsigned_rational<jkj::big_uint> target_number;
|
|
32
|
+
for (int k = impl::min_k; k <= impl::max_k; ++k) {
|
|
33
|
+
// (2f_c +- 1) * 2^beta * (2^(k - e_k - Q) * 5^k)
|
|
34
|
+
// e_k = floor(k log2(10)) - Q + 1, so
|
|
35
|
+
// k - e_k - Q = k - floor(k log2(10)) - 1.
|
|
36
|
+
int exp_2 = k - jkj::dragonbox::detail::log::floor_log2_pow10(k) - 1;
|
|
37
|
+
|
|
38
|
+
target_number.numerator = 1;
|
|
39
|
+
target_number.denominator = 1;
|
|
40
|
+
if (k >= 0) {
|
|
41
|
+
target_number.numerator = jkj::big_uint::pow(5, k);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
target_number.denominator = jkj::big_uint::pow(5, -k);
|
|
45
|
+
}
|
|
46
|
+
if (exp_2 >= 0) {
|
|
47
|
+
target_number.numerator *= jkj::big_uint::power_of_2(exp_2);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
target_number.denominator *= jkj::big_uint::power_of_2(-exp_2);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
auto div_res = div(jkj::big_uint::power_of_2(impl::cache_bits) * target_number.numerator,
|
|
54
|
+
target_number.denominator);
|
|
55
|
+
auto m = std::move(div_res.quot);
|
|
56
|
+
if (!div_res.rem.is_zero()) {
|
|
57
|
+
m += 1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Recheck that m is in the correct range.
|
|
61
|
+
if (m < jkj::big_uint::power_of_2(impl::cache_bits - 1) ||
|
|
62
|
+
m >= jkj::big_uint::power_of_2(impl::cache_bits)) {
|
|
63
|
+
throw std::logic_error{"Generated cache entry is not in the correct range"};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
results.push_back(std::move(m));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return results;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
#include <fstream>
|
|
73
|
+
#include <iomanip>
|
|
74
|
+
#include <iostream>
|
|
75
|
+
|
|
76
|
+
int main() {
|
|
77
|
+
std::cout << "[Generating cache...]\n";
|
|
78
|
+
|
|
79
|
+
using jkj::dragonbox::detail::impl;
|
|
80
|
+
|
|
81
|
+
auto write_file = [](std::ofstream& out, auto type_tag, auto const& cache_array,
|
|
82
|
+
auto&& ieee_754_type_name_string, auto&& element_printer) {
|
|
83
|
+
using float_type = typename decltype(type_tag)::type;
|
|
84
|
+
|
|
85
|
+
out << "static constexpr int min_k = " << std::dec << impl<float_type>::min_k << ";\n";
|
|
86
|
+
out << "static constexpr int max_k = " << std::dec << impl<float_type>::max_k << ";\n";
|
|
87
|
+
out << "static constexpr cache_entry_type cache[] = {";
|
|
88
|
+
for (int k = impl<float_type>::min_k; k < impl<float_type>::max_k; ++k) {
|
|
89
|
+
auto idx = std::size_t(k - impl<float_type>::min_k);
|
|
90
|
+
out << "\n\t";
|
|
91
|
+
element_printer(out, cache_array[idx]);
|
|
92
|
+
out << ",";
|
|
93
|
+
}
|
|
94
|
+
out << "\n\t";
|
|
95
|
+
element_printer(out, cache_array.back());
|
|
96
|
+
out << "\n};";
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
std::ofstream out;
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
out.open("results/binary32_generated_cache.txt");
|
|
103
|
+
auto binary32_cache = generate_cache<jkj::dragonbox::default_float_traits<float>>();
|
|
104
|
+
write_file(out, jkj::dragonbox::default_float_traits<float>{}, binary32_cache, "binary32",
|
|
105
|
+
[](std::ofstream& out, jkj::big_uint const& value) {
|
|
106
|
+
out << "0x" << std::hex << std::setw(16) << std::setfill('0') << value[0];
|
|
107
|
+
});
|
|
108
|
+
out.close();
|
|
109
|
+
|
|
110
|
+
out.open("results/binary64_generated_cache.txt");
|
|
111
|
+
auto binary64_cache = generate_cache<jkj::dragonbox::default_float_traits<double>>();
|
|
112
|
+
write_file(out, jkj::dragonbox::default_float_traits<double>{}, binary64_cache, "binary64",
|
|
113
|
+
[](std::ofstream& out, jkj::big_uint const& value) {
|
|
114
|
+
out << "{ 0x" << std::hex << std::setw(16) << std::setfill('0') << value[1]
|
|
115
|
+
<< ", 0x" << std::hex << std::setw(16) << std::setfill('0') << value[0]
|
|
116
|
+
<< " }";
|
|
117
|
+
});
|
|
118
|
+
out.close();
|
|
119
|
+
}
|
|
120
|
+
catch (std::logic_error const& ex) {
|
|
121
|
+
std::cout << ex.what() << "\n";
|
|
122
|
+
return -1;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
std::cout << "Done.\n\n\n";
|
|
126
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Copyright 2020 Junekey Jeon
|
|
2
|
+
//
|
|
3
|
+
// The contents of this file may be used under the terms of
|
|
4
|
+
// the Apache License v2.0 with LLVM Exceptions.
|
|
5
|
+
//
|
|
6
|
+
// (See accompanying file LICENSE-Apache or copy at
|
|
7
|
+
// https://llvm.org/foundation/relicensing/LICENSE.txt)
|
|
8
|
+
//
|
|
9
|
+
// Alternatively, the contents of this file may be used under the terms of
|
|
10
|
+
// the Boost Software License, Version 1.0.
|
|
11
|
+
// (See accompanying file LICENSE-Boost or copy at
|
|
12
|
+
// https://www.boost.org/LICENSE_1_0.txt)
|
|
13
|
+
//
|
|
14
|
+
// Unless required by applicable law or agreed to in writing, this software
|
|
15
|
+
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
// KIND, either express or implied.
|
|
17
|
+
|
|
18
|
+
#include "dragonbox/dragonbox_to_chars.h"
|
|
19
|
+
|
|
20
|
+
#include <iostream>
|
|
21
|
+
#include <iomanip>
|
|
22
|
+
#include <string>
|
|
23
|
+
|
|
24
|
+
template <class Float>
|
|
25
|
+
static void live_test() {
|
|
26
|
+
char buffer[41];
|
|
27
|
+
|
|
28
|
+
while (true) {
|
|
29
|
+
Float x;
|
|
30
|
+
std::string x_str;
|
|
31
|
+
while (true) {
|
|
32
|
+
std::getline(std::cin, x_str);
|
|
33
|
+
try {
|
|
34
|
+
if constexpr (std::is_same_v<Float, float>) {
|
|
35
|
+
x = std::stof(x_str);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
x = std::stod(x_str);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (...) {
|
|
42
|
+
std::cout << "Not a valid input; input again.\n";
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
auto xx = jkj::dragonbox::float_bits<Float>{x};
|
|
49
|
+
std::cout << " sign: " << (xx.is_negative() ? "-" : "+") << std::endl;
|
|
50
|
+
std::cout << " exponent bits: "
|
|
51
|
+
<< "0x" << std::hex << std::setfill('0') << xx.extract_exponent_bits() << std::dec
|
|
52
|
+
<< " (value: " << xx.binary_exponent() << ")\n";
|
|
53
|
+
std::cout << " significand bits: "
|
|
54
|
+
<< "0x" << std::hex << std::setfill('0');
|
|
55
|
+
if constexpr (std::is_same_v<Float, float>) {
|
|
56
|
+
std::cout << std::setw(8);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
std::cout << std::setw(16);
|
|
60
|
+
}
|
|
61
|
+
std::cout << xx.extract_significand_bits() << " (value: 0x" << xx.binary_significand()
|
|
62
|
+
<< ")\n"
|
|
63
|
+
<< std::dec;
|
|
64
|
+
|
|
65
|
+
jkj::dragonbox::to_chars(x, buffer);
|
|
66
|
+
std::cout << " Dragonbox output: " << buffer << "\n\n";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
int main() {
|
|
71
|
+
constexpr enum { test_float, test_double } test = test_double;
|
|
72
|
+
|
|
73
|
+
if constexpr (test == test_float) {
|
|
74
|
+
std::cout << "[Start live test for float's]\n";
|
|
75
|
+
live_test<float>();
|
|
76
|
+
}
|
|
77
|
+
else if constexpr (test == test_double) {
|
|
78
|
+
std::cout << "[Start live test for double's]\n";
|
|
79
|
+
live_test<double>();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Copyright 2020 Junekey Jeon
|
|
2
|
+
//
|
|
3
|
+
// The contents of this file may be used under the terms of
|
|
4
|
+
// the Apache License v2.0 with LLVM Exceptions.
|
|
5
|
+
//
|
|
6
|
+
// (See accompanying file LICENSE-Apache or copy at
|
|
7
|
+
// https://llvm.org/foundation/relicensing/LICENSE.txt)
|
|
8
|
+
//
|
|
9
|
+
// Alternatively, the contents of this file may be used under the terms of
|
|
10
|
+
// the Boost Software License, Version 1.0.
|
|
11
|
+
// (See accompanying file LICENSE-Boost or copy at
|
|
12
|
+
// https://www.boost.org/LICENSE_1_0.txt)
|
|
13
|
+
//
|
|
14
|
+
// Unless required by applicable law or agreed to in writing, this software
|
|
15
|
+
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
// KIND, either express or implied.
|
|
17
|
+
|
|
18
|
+
#include "dragonbox/dragonbox_to_chars.h"
|
|
19
|
+
#include "random_float.h"
|
|
20
|
+
#include <chrono>
|
|
21
|
+
#include <iostream>
|
|
22
|
+
|
|
23
|
+
template <class Float>
|
|
24
|
+
static void uniform_random_perf_test(std::size_t number_of_tests)
|
|
25
|
+
{
|
|
26
|
+
std::cout << "Generating random samples...\n";
|
|
27
|
+
auto rg = generate_correctly_seeded_mt19937_64();
|
|
28
|
+
std::vector<Float> samples(number_of_tests);
|
|
29
|
+
for (auto& sample : samples) {
|
|
30
|
+
sample = uniformly_randomly_generate_general_float<Float>(rg);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
std::cout << "Performing test...\n";
|
|
34
|
+
char buffer[41];
|
|
35
|
+
auto from = std::chrono::steady_clock::now();
|
|
36
|
+
for (auto& sample : samples) {
|
|
37
|
+
jkj::dragonbox::to_chars(sample, buffer);
|
|
38
|
+
}
|
|
39
|
+
auto dur = std::chrono::steady_clock::now() - from;
|
|
40
|
+
std::cout << "Average time: " <<
|
|
41
|
+
double(std::chrono::duration_cast<std::chrono::nanoseconds>(dur).count()) / number_of_tests << "ns\n";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
template <class Float>
|
|
45
|
+
static void digit_perf_test(unsigned int digits, std::size_t number_of_tests)
|
|
46
|
+
{
|
|
47
|
+
std::cout << "Generating random samples...\n";
|
|
48
|
+
auto rg = generate_correctly_seeded_mt19937_64();
|
|
49
|
+
std::vector<Float> samples(number_of_tests);
|
|
50
|
+
for (auto& sample : samples) {
|
|
51
|
+
sample = randomly_generate_float_with_given_digits<Float>(digits, rg);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
std::cout << "Performing test...\n";
|
|
55
|
+
char buffer[41];
|
|
56
|
+
auto from = std::chrono::steady_clock::now();
|
|
57
|
+
for (auto& sample : samples) {
|
|
58
|
+
jkj::dragonbox::to_chars(sample, buffer);
|
|
59
|
+
}
|
|
60
|
+
auto dur = std::chrono::steady_clock::now() - from;
|
|
61
|
+
std::cout << "Average time: " <<
|
|
62
|
+
double(std::chrono::duration_cast<std::chrono::nanoseconds>(dur).count()) / number_of_tests << "ns\n";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
int main()
|
|
66
|
+
{
|
|
67
|
+
constexpr bool run_uniform_random_float = true;
|
|
68
|
+
constexpr std::size_t number_of_uniform_random_perf_tests_float = 100000000;
|
|
69
|
+
|
|
70
|
+
constexpr bool run_uniform_random_double = true;
|
|
71
|
+
constexpr std::size_t number_of_uniform_random_perf_tests_double = 100000000;
|
|
72
|
+
|
|
73
|
+
constexpr bool run_digit_float = false;
|
|
74
|
+
constexpr unsigned int digits_for_perf_test_float = 6;
|
|
75
|
+
constexpr std::size_t number_of_digit_perf_tests_float = 40000000;
|
|
76
|
+
|
|
77
|
+
constexpr bool run_digit_double = false;
|
|
78
|
+
constexpr static unsigned int digits_for_perf_test_double = 17;
|
|
79
|
+
constexpr static std::size_t number_of_digit_perf_tests_double = 6000000;
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
if constexpr (run_uniform_random_float) {
|
|
83
|
+
std::cout << "[Running the algorithm with uniformly randomly generated float inputs...]\n";
|
|
84
|
+
uniform_random_perf_test<float>(number_of_uniform_random_perf_tests_float);
|
|
85
|
+
std::cout << "Done.\n\n\n";
|
|
86
|
+
}
|
|
87
|
+
if constexpr (run_uniform_random_double) {
|
|
88
|
+
std::cout << "[Running the algorithm with uniformly randomly generated double inputs...]\n";
|
|
89
|
+
uniform_random_perf_test<double>(number_of_uniform_random_perf_tests_double);
|
|
90
|
+
std::cout << "Done.\n\n\n";
|
|
91
|
+
}
|
|
92
|
+
if constexpr (run_digit_float) {
|
|
93
|
+
std::cout << "[Running the algorithm with float inputs of digits = "
|
|
94
|
+
<< digits_for_perf_test_float << "...]\n";
|
|
95
|
+
digit_perf_test<float>(digits_for_perf_test_float, number_of_digit_perf_tests_float);
|
|
96
|
+
std::cout << "Done.\n\n\n";
|
|
97
|
+
}
|
|
98
|
+
if constexpr (run_digit_double) {
|
|
99
|
+
std::cout << "[Running the algorithm with double inputs of digits = "
|
|
100
|
+
<< digits_for_perf_test_double << "...]\n";
|
|
101
|
+
digit_perf_test<double>(digits_for_perf_test_double, number_of_digit_perf_tests_double);
|
|
102
|
+
std::cout << "Done.\n\n\n";
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright 2020-2022 Junekey Jeon
|
|
2
|
+
//
|
|
3
|
+
// The contents of this file may be used under the terms of
|
|
4
|
+
// the Apache License v2.0 with LLVM Exceptions.
|
|
5
|
+
//
|
|
6
|
+
// (See accompanying file LICENSE-Apache or copy at
|
|
7
|
+
// https://llvm.org/foundation/relicensing/LICENSE.txt)
|
|
8
|
+
//
|
|
9
|
+
// Alternatively, the contents of this file may be used under the terms of
|
|
10
|
+
// the Boost Software License, Version 1.0.
|
|
11
|
+
// (See accompanying file LICENSE-Boost or copy at
|
|
12
|
+
// https://www.boost.org/LICENSE_1_0.txt)
|
|
13
|
+
//
|
|
14
|
+
// Unless required by applicable law or agreed to in writing, this software
|
|
15
|
+
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
// KIND, either express or implied.
|
|
17
|
+
|
|
18
|
+
#include "dragonbox/dragonbox.h"
|
|
19
|
+
|
|
20
|
+
int main() {}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
|
2
|
+
|
|
3
|
+
project(dragonboxTests LANGUAGES CXX)
|
|
4
|
+
|
|
5
|
+
# ---- Add dependencies ----
|
|
6
|
+
|
|
7
|
+
# We want warnings in tests
|
|
8
|
+
set(dragonbox_INCLUDE_WITHOUT_SYSTEM ON CACHE INTERNAL "")
|
|
9
|
+
|
|
10
|
+
include(FetchContent)
|
|
11
|
+
if (NOT TARGET dragonbox)
|
|
12
|
+
FetchContent_Declare(dragonbox SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../..")
|
|
13
|
+
FetchContent_MakeAvailable(dragonbox)
|
|
14
|
+
endif()
|
|
15
|
+
if (NOT TARGET common)
|
|
16
|
+
FetchContent_Declare(common SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../common")
|
|
17
|
+
FetchContent_MakeAvailable(common)
|
|
18
|
+
endif()
|
|
19
|
+
if (NOT TARGET ryu)
|
|
20
|
+
FetchContent_Declare(ryu SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../3rdparty/ryu")
|
|
21
|
+
FetchContent_MakeAvailable(ryu)
|
|
22
|
+
endif()
|
|
23
|
+
|
|
24
|
+
# ---- Tests ----
|
|
25
|
+
|
|
26
|
+
enable_testing()
|
|
27
|
+
|
|
28
|
+
function(add_test NAME)
|
|
29
|
+
cmake_parse_arguments(TEST "TO_CHARS;RYU" "NAME" "" ${ARGN})
|
|
30
|
+
if(TEST_TO_CHARS)
|
|
31
|
+
set(dragonbox dragonbox::dragonbox_to_chars)
|
|
32
|
+
else()
|
|
33
|
+
set(dragonbox dragonbox::dragonbox)
|
|
34
|
+
endif()
|
|
35
|
+
|
|
36
|
+
add_executable(${NAME} source/${NAME}.cpp)
|
|
37
|
+
|
|
38
|
+
target_link_libraries(${NAME} PRIVATE ${dragonbox} dragonbox::common)
|
|
39
|
+
|
|
40
|
+
if(TEST_RYU)
|
|
41
|
+
target_link_libraries(${NAME} PRIVATE ryu::ryu)
|
|
42
|
+
endif()
|
|
43
|
+
|
|
44
|
+
target_compile_features(${NAME} PRIVATE cxx_std_17)
|
|
45
|
+
|
|
46
|
+
_add_test(NAME ${NAME} COMMAND ${NAME})
|
|
47
|
+
|
|
48
|
+
# ---- MSVC Specifics ----
|
|
49
|
+
if (MSVC)
|
|
50
|
+
# No need to not generate PDB
|
|
51
|
+
# /permissive- should be the default
|
|
52
|
+
# The compilation will fail without /experimental:newLambdaProcessor
|
|
53
|
+
# See also https://gitlab.kitware.com/cmake/cmake/-/issues/16478
|
|
54
|
+
target_compile_options(${NAME} PUBLIC
|
|
55
|
+
/Zi /permissive-
|
|
56
|
+
$<$<NOT:$<CXX_COMPILER_ID:Clang>>:/experimental:newLambdaProcessor>
|
|
57
|
+
$<$<CONFIG:Release>:/GL>)
|
|
58
|
+
target_link_options(${NAME} PUBLIC /LTCG /DEBUG:FASTLINK)
|
|
59
|
+
set_target_properties(${NAME} PROPERTIES
|
|
60
|
+
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}")
|
|
61
|
+
endif()
|
|
62
|
+
endfunction()
|
|
63
|
+
|
|
64
|
+
add_test(verify_cache_precision)
|
|
65
|
+
add_test(test_all_shorter_interval_cases TO_CHARS RYU)
|
|
66
|
+
add_test(uniform_random_test TO_CHARS RYU)
|
|
67
|
+
add_test(verify_compressed_cache)
|
|
68
|
+
add_test(verify_fast_multiplication)
|
|
69
|
+
add_test(verify_log_computation)
|
|
70
|
+
add_test(verify_magic_division)
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
e,bits_for_multiplication,bits_for_integer_check
|
|
2
|
+
-149,50,61
|
|
3
|
+
-148,54,60
|
|
4
|
+
-147,55,59
|
|
5
|
+
-146,48,57
|
|
6
|
+
-145,54,57
|
|
7
|
+
-144,54,56
|
|
8
|
+
-143,54,57
|
|
9
|
+
-142,56,56
|
|
10
|
+
-141,56,56
|
|
11
|
+
-140,56,57
|
|
12
|
+
-139,46,58
|
|
13
|
+
-138,53,60
|
|
14
|
+
-137,53,60
|
|
15
|
+
-136,52,63
|
|
16
|
+
-135,52,63
|
|
17
|
+
-134,52,63
|
|
18
|
+
-133,52,63
|
|
19
|
+
-132,50,63
|
|
20
|
+
-131,50,63
|
|
21
|
+
-130,53,62
|
|
22
|
+
-129,52,62
|
|
23
|
+
-128,53,61
|
|
24
|
+
-127,53,60
|
|
25
|
+
-126,48,53
|
|
26
|
+
-125,48,53
|
|
27
|
+
-124,61,57
|
|
28
|
+
-123,61,56
|
|
29
|
+
-122,52,59
|
|
30
|
+
-121,55,58
|
|
31
|
+
-120,61,57
|
|
32
|
+
-119,54,57
|
|
33
|
+
-118,54,57
|
|
34
|
+
-117,54,59
|
|
35
|
+
-116,51,59
|
|
36
|
+
-115,53,58
|
|
37
|
+
-114,55,57
|
|
38
|
+
-113,55,60
|
|
39
|
+
-112,55,57
|
|
40
|
+
-111,55,57
|
|
41
|
+
-110,55,58
|
|
42
|
+
-109,51,60
|
|
43
|
+
-108,54,59
|
|
44
|
+
-107,54,58
|
|
45
|
+
-106,52,60
|
|
46
|
+
-105,53,59
|
|
47
|
+
-104,53,58
|
|
48
|
+
-103,54,57
|
|
49
|
+
-102,50,60
|
|
50
|
+
-101,55,59
|
|
51
|
+
-100,55,58
|
|
52
|
+
-99,52,59
|
|
53
|
+
-98,54,58
|
|
54
|
+
-97,54,57
|
|
55
|
+
-96,51,59
|
|
56
|
+
-95,51,58
|
|
57
|
+
-94,52,57
|
|
58
|
+
-93,52,59
|
|
59
|
+
-92,52,59
|
|
60
|
+
-91,52,58
|
|
61
|
+
-90,54,58
|
|
62
|
+
-89,50,56
|
|
63
|
+
-88,54,59
|
|
64
|
+
-87,55,58
|
|
65
|
+
-86,51,58
|
|
66
|
+
-85,52,58
|
|
67
|
+
-84,52,58
|
|
68
|
+
-83,50,57
|
|
69
|
+
-82,53,58
|
|
70
|
+
-81,53,66
|
|
71
|
+
-80,53,66
|
|
72
|
+
-79,52,59
|
|
73
|
+
-78,52,58
|
|
74
|
+
-77,52,57
|
|
75
|
+
-76,52,58
|
|
76
|
+
-75,54,58
|
|
77
|
+
-74,54,58
|
|
78
|
+
-73,45,56
|
|
79
|
+
-72,45,55
|
|
80
|
+
-71,45,55
|
|
81
|
+
-70,54,57
|
|
82
|
+
-69,52,58
|
|
83
|
+
-68,52,58
|
|
84
|
+
-67,52,58
|
|
85
|
+
-66,49,58
|
|
86
|
+
-65,49,57
|
|
87
|
+
-64,49,57
|
|
88
|
+
-63,47,56
|
|
89
|
+
-62,47,57
|
|
90
|
+
-61,47,61
|
|
91
|
+
-60,47,60
|
|
92
|
+
-59,45,57
|
|
93
|
+
-58,45,60
|
|
94
|
+
-57,45,60
|
|
95
|
+
-56,42,58
|
|
96
|
+
-55,42,58
|
|
97
|
+
-54,42,57
|
|
98
|
+
-53,40,59
|
|
99
|
+
-52,40,59
|
|
100
|
+
-51,40,58
|
|
101
|
+
-50,40,57
|
|
102
|
+
-49,38,58
|
|
103
|
+
-48,38,58
|
|
104
|
+
-47,38,57
|
|
105
|
+
-46,35,57
|
|
106
|
+
-45,35,57
|
|
107
|
+
-44,35,60
|
|
108
|
+
-43,33,59
|
|
109
|
+
-42,33,58
|
|
110
|
+
-41,33,60
|
|
111
|
+
-40,33,59
|
|
112
|
+
-39,31,57
|
|
113
|
+
-38,31,57
|
|
114
|
+
-37,31,57
|
|
115
|
+
-36,28,57
|
|
116
|
+
-35,28,56
|
|
117
|
+
-34,28,55
|
|
118
|
+
-33,26,55
|
|
119
|
+
-32,26,54
|
|
120
|
+
-31,26,53
|
|
121
|
+
-30,26,52
|
|
122
|
+
-29,24,52
|
|
123
|
+
-28,24,51
|
|
124
|
+
-27,24,50
|
|
125
|
+
-26,21,50
|
|
126
|
+
-25,21,49
|
|
127
|
+
-24,21,48
|
|
128
|
+
-23,19,48
|
|
129
|
+
-22,19,47
|
|
130
|
+
-21,19,46
|
|
131
|
+
-20,19,45
|
|
132
|
+
-19,17,45
|
|
133
|
+
-18,17,44
|
|
134
|
+
-17,17,43
|
|
135
|
+
-16,14,43
|
|
136
|
+
-15,14,42
|
|
137
|
+
-14,14,41
|
|
138
|
+
-13,12,41
|
|
139
|
+
-12,12,40
|
|
140
|
+
-11,12,39
|
|
141
|
+
-10,12,38
|
|
142
|
+
-9,10,38
|
|
143
|
+
-8,10,37
|
|
144
|
+
-7,10,36
|
|
145
|
+
-6,7,36
|
|
146
|
+
-5,7,35
|
|
147
|
+
-4,7,34
|
|
148
|
+
-3,5,34
|
|
149
|
+
-2,5,33
|
|
150
|
+
-1,5,32
|
|
151
|
+
0,3,32
|
|
152
|
+
1,3,32
|
|
153
|
+
2,3,32
|
|
154
|
+
3,3,32
|
|
155
|
+
4,1,32
|
|
156
|
+
5,1,32
|
|
157
|
+
6,1,32
|
|
158
|
+
7,31,35
|
|
159
|
+
8,31,35
|
|
160
|
+
9,32,35
|
|
161
|
+
10,31,37
|
|
162
|
+
11,33,37
|
|
163
|
+
12,33,37
|
|
164
|
+
13,33,37
|
|
165
|
+
14,36,39
|
|
166
|
+
15,36,39
|
|
167
|
+
16,36,39
|
|
168
|
+
17,37,42
|
|
169
|
+
18,38,42
|
|
170
|
+
19,40,42
|
|
171
|
+
20,38,44
|
|
172
|
+
21,41,44
|
|
173
|
+
22,41,44
|
|
174
|
+
23,43,44
|
|
175
|
+
24,41,46
|
|
176
|
+
25,44,46
|
|
177
|
+
26,44,46
|
|
178
|
+
27,41,49
|
|
179
|
+
28,41,49
|
|
180
|
+
29,46,49
|
|
181
|
+
30,46,51
|
|
182
|
+
31,47,51
|
|
183
|
+
32,47,51
|
|
184
|
+
33,47,51
|
|
185
|
+
34,50,53
|
|
186
|
+
35,50,53
|
|
187
|
+
36,52,53
|
|
188
|
+
37,51,56
|
|
189
|
+
38,51,56
|
|
190
|
+
39,53,56
|
|
191
|
+
40,52,58
|
|
192
|
+
41,54,58
|
|
193
|
+
42,54,57
|
|
194
|
+
43,54,56
|
|
195
|
+
44,54,57
|
|
196
|
+
45,54,57
|
|
197
|
+
46,54,60
|
|
198
|
+
47,51,63
|
|
199
|
+
48,52,62
|
|
200
|
+
49,52,61
|
|
201
|
+
50,51,59
|
|
202
|
+
51,54,58
|
|
203
|
+
52,57,57
|
|
204
|
+
53,57,57
|
|
205
|
+
54,52,58
|
|
206
|
+
55,52,57
|
|
207
|
+
56,55,62
|
|
208
|
+
57,52,64
|
|
209
|
+
58,52,64
|
|
210
|
+
59,53,63
|
|
211
|
+
60,50,57
|
|
212
|
+
61,53,58
|
|
213
|
+
62,53,58
|
|
214
|
+
63,56,58
|
|
215
|
+
64,51,57
|
|
216
|
+
65,51,59
|
|
217
|
+
66,55,58
|
|
218
|
+
67,52,55
|
|
219
|
+
68,52,54
|
|
220
|
+
69,52,53
|
|
221
|
+
70,51,56
|
|
222
|
+
71,51,55
|
|
223
|
+
72,51,55
|
|
224
|
+
73,54,64
|
|
225
|
+
74,49,59
|
|
226
|
+
75,49,59
|
|
227
|
+
76,49,59
|
|
228
|
+
77,50,62
|
|
229
|
+
78,50,62
|
|
230
|
+
79,50,62
|
|
231
|
+
80,51,62
|
|
232
|
+
81,51,62
|
|
233
|
+
82,51,62
|
|
234
|
+
83,51,62
|
|
235
|
+
84,50,62
|
|
236
|
+
85,50,62
|
|
237
|
+
86,50,62
|
|
238
|
+
87,51,62
|
|
239
|
+
88,51,62
|
|
240
|
+
89,51,62
|
|
241
|
+
90,50,62
|
|
242
|
+
91,51,61
|
|
243
|
+
92,51,60
|
|
244
|
+
93,51,59
|
|
245
|
+
94,49,59
|
|
246
|
+
95,56,58
|
|
247
|
+
96,56,57
|
|
248
|
+
97,52,58
|
|
249
|
+
98,54,57
|
|
250
|
+
99,54,58
|
|
251
|
+
100,50,58
|
|
252
|
+
101,50,58
|
|
253
|
+
102,54,57
|
|
254
|
+
103,48,60
|
|
255
|
+
104,48,59
|