koffi 1.3.0-rc.1 → 1.3.2
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 +6 -2
- package/ChangeLog.md +65 -0
- package/build/qemu/1.3.2/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_win32_x64.tar.gz +0 -0
- package/doc/conf.py +2 -2
- package/doc/dist/doctrees/environment.pickle +0 -0
- package/doc/dist/doctrees/index.doctree +0 -0
- package/doc/dist/html/_sources/index.rst.txt +2 -2
- package/doc/dist/html/index.html +3 -3
- package/doc/dist/html/objects.inv +0 -0
- package/doc/dist/html/platforms.html +1 -1
- package/doc/dist/html/searchindex.js +1 -1
- package/doc/index.rst +2 -2
- package/package.json +4 -3
- package/qemu/qemu.js +1 -1
- package/src/abi_x64_sysv_fwd.S +14 -4
- package/src/abi_x86_fwd.S +6 -4
- package/src/call.cc +4 -4
- package/src/ffi.cc +3 -1
- package/test/CMakeLists.txt +1 -1
- package/vendor/libcc/libcc.cc +17 -5
- package/vendor/libcc/libcc.hh +32 -0
- package/build/qemu/1.3.0-rc.1/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/1.3.0-rc.1/koffi_win32_x64.tar.gz +0 -0
package/CMakeLists.txt
CHANGED
|
@@ -11,12 +11,16 @@
|
|
|
11
11
|
# You should have received a copy of the GNU Affero General Public License
|
|
12
12
|
# along with this program. If not, see https://www.gnu.org/licenses/.
|
|
13
13
|
|
|
14
|
-
cmake_minimum_required(VERSION 3.
|
|
14
|
+
cmake_minimum_required(VERSION 3.6)
|
|
15
15
|
project(koffi C CXX ASM)
|
|
16
16
|
|
|
17
17
|
find_package(CNoke)
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.8.0")
|
|
20
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
21
|
+
else()
|
|
22
|
+
set(CMAKE_CXX_STANDARD 14)
|
|
23
|
+
endif()
|
|
20
24
|
if(MSVC)
|
|
21
25
|
add_compile_options(/W4 /wd4200 /wd4458 /wd4706 /wd4100 /wd4127 /wd4702 /wd4201 /wd4324)
|
|
22
26
|
|
package/ChangeLog.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Koffi 1.3.2
|
|
2
|
+
|
|
3
|
+
## Main fixes
|
|
4
|
+
|
|
5
|
+
- Support compilation in C++14 mode (graceful degradation)
|
|
6
|
+
- Support older toolchains on Linux (tested on Debian 9)
|
|
7
|
+
|
|
8
|
+
# Koffi 1.3.1
|
|
9
|
+
|
|
10
|
+
## Main fixes
|
|
11
|
+
|
|
12
|
+
- The prebuilt binary is tested when Koffi is installed, and a rebuild happens if it fails to load
|
|
13
|
+
|
|
14
|
+
# Koffi 1.3.0
|
|
15
|
+
|
|
16
|
+
## Major changes
|
|
17
|
+
|
|
18
|
+
- Expand and move documentation to https://koffi.dev/
|
|
19
|
+
- Support JS arrays and TypedArrays for pointer arguments (input, output and mixed)
|
|
20
|
+
|
|
21
|
+
## Other changes
|
|
22
|
+
|
|
23
|
+
- Convert NULL string pointers to null instead of crashing (return values, struct and array members, callbacks)
|
|
24
|
+
- Default to 'string' array hint for char, char16 and char16_t arrays
|
|
25
|
+
- Fix definition of long types on Windows x64 (LLP64 model)
|
|
26
|
+
- Restrict automatic string conversion to signed char types
|
|
27
|
+
- Detect floating-point ABI before using prebuilt binaries (ARM32, RISC-V)
|
|
28
|
+
- Forbid duplicate member names in struct types
|
|
29
|
+
|
|
30
|
+
# Koffi 1.2.4
|
|
31
|
+
|
|
32
|
+
## New features
|
|
33
|
+
|
|
34
|
+
- Windows ARM64 is now supported
|
|
35
|
+
|
|
36
|
+
# Koffi 1.2.3
|
|
37
|
+
|
|
38
|
+
## New features
|
|
39
|
+
|
|
40
|
+
- A prebuilt binary for macOS ARM64 (M1) is now included
|
|
41
|
+
|
|
42
|
+
# Koffi 1.2.1
|
|
43
|
+
|
|
44
|
+
This entry documents changes since version 1.1.0.
|
|
45
|
+
|
|
46
|
+
## New features
|
|
47
|
+
|
|
48
|
+
- JS functions can be used as C callbacks (cdecl, stdcall) on all platforms
|
|
49
|
+
- RISC-V 64 LP64D ABI is supported (LP64 is untested)
|
|
50
|
+
- Expose settings for memory usage of synchronous and asynchronous calls
|
|
51
|
+
- Transparent conversion between C buffers and strings
|
|
52
|
+
- Tentative support for Windows ARM64 (untested)
|
|
53
|
+
|
|
54
|
+
## Main fixes
|
|
55
|
+
|
|
56
|
+
- Fix excessive stack alignment of structs on x86 platforms
|
|
57
|
+
- Fix potential problems with big int64_t/uint64_t values
|
|
58
|
+
- Fix possible struct layout errors in push/pop code
|
|
59
|
+
- Fix alignment issues in ARM32 push code
|
|
60
|
+
- Fix incomplete/buggy support for HFA structs on ARM32 and ARM64
|
|
61
|
+
- Fix crashes on OpenBSD caused by missing MAP_STACK flag
|
|
62
|
+
- Fix non-sense "duplicate array type" errors
|
|
63
|
+
- Fix value `koffi.internal` to false in module (normal) builds
|
|
64
|
+
- Make sure we have a redzone below the stack for all architectures
|
|
65
|
+
- Use slower allocation for big objects instead of failing
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/doc/conf.py
CHANGED
|
Binary file
|
|
Binary file
|
package/doc/dist/html/index.html
CHANGED
|
@@ -202,8 +202,8 @@
|
|
|
202
202
|
</label>
|
|
203
203
|
</div>
|
|
204
204
|
<article role="main">
|
|
205
|
-
<section id="koffi">
|
|
206
|
-
<h1>Koffi<a class="headerlink" href="#koffi" title="Permalink to this heading">#</a></h1>
|
|
205
|
+
<section id="koffi-version">
|
|
206
|
+
<h1>Koffi 1.3.2<a class="headerlink" href="#koffi-version" title="Permalink to this heading">#</a></h1>
|
|
207
207
|
<section id="overview">
|
|
208
208
|
<h2>Overview<a class="headerlink" href="#overview" title="Permalink to this heading">#</a></h2>
|
|
209
209
|
<p>Koffi is a <strong>fast and easy-to-use C FFI module for Node.js</strong>, featuring:</p>
|
|
@@ -317,7 +317,7 @@
|
|
|
317
317
|
<div class="toc-tree-container">
|
|
318
318
|
<div class="toc-tree">
|
|
319
319
|
<ul>
|
|
320
|
-
<li><a class="reference internal" href="#">Koffi</a><ul>
|
|
320
|
+
<li><a class="reference internal" href="#">Koffi 1.3.2</a><ul>
|
|
321
321
|
<li><a class="reference internal" href="#overview">Overview</a></li>
|
|
322
322
|
<li><a class="reference internal" href="#table-of-contents">Table of contents</a></li>
|
|
323
323
|
<li><a class="reference internal" href="#license">License</a></li>
|
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head><meta charset="utf-8"/>
|
|
4
4
|
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
|
5
5
|
<meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
|
|
6
|
-
<link rel="index" title="Index" href="genindex" /><link rel="search" title="Search" href="search" /><link rel="next" title="Quick start" href="start" /><link rel="prev" title="Koffi" href="index" />
|
|
6
|
+
<link rel="index" title="Index" href="genindex" /><link rel="search" title="Search" href="search" /><link rel="next" title="Quick start" href="start" /><link rel="prev" title="Koffi 1.3.2" href="index" />
|
|
7
7
|
|
|
8
8
|
<meta name="generator" content="sphinx-5.0.1, furo 2022.06.04.1"/>
|
|
9
9
|
<title>Supported platforms - Koffi</title>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Search.setIndex({"docnames": ["benchmarks", "contribute", "functions", "index", "memory", "platforms", "start", "types"], "filenames": ["benchmarks.md", "contribute.md", "functions.md", "index.rst", "memory.md", "platforms.md", "start.md", "types.md"], "titles": ["Benchmarks", "Contributing", "Function calls", "Koffi", "Memory usage", "Supported platforms", "Quick start", "Data types"], "terms": {"here": [0, 1, 2, 3, 7], "quick": [0, 3], "overview": 0, "execut": 0, "time": [0, 1, 6], "koffi": [0, 1, 2, 4, 5, 6, 7], "call": [0, 3, 4, 5, 6, 7], "three": [0, 6, 7], "test": [0, 3, 5], "case": [0, 1, 2, 7], "one": [0, 2, 4, 6, 7], "base": [0, 2, 3, 7], "around": [0, 4, 7], "compar": 0, "theoret": 0, "ideal": 0, "implement": [0, 7], "These": [0, 1, 7], "ar": [0, 1, 2, 4, 5, 6, 7], "detail": 0, "explain": 0, "below": [0, 1, 2, 6, 7], "node": [0, 1, 2, 3, 6], "ffi": [0, 2, 3, 6], "napi": 0, "thi": [0, 1, 2, 3, 6, 7], "repeat": 0, "simpl": [0, 1, 2, 7], "standard": [0, 2, 7], "c": [0, 1, 3, 4, 5, 6], "function": [0, 1, 3, 6, 7], "ha": [0, 1, 2, 7], "first": [0, 1, 2, 6, 7], "refer": [0, 3, 7], "through": [0, 2, 7], "an": [0, 2, 4, 7], "n": [0, 5, 6, 7], "api": [0, 1, 2, 6, 7], "modul": [0, 3], "close": [0, 7], "limit": 0, "perfect": 0, "overhead": [0, 3], "js": [0, 1, 2, 3, 5, 7], "second": [0, 2, 6, 7], "third": [0, 7], "us": [0, 1, 3, 4, 5, 6, 7], "offici": [0, 1, 5], "becaus": [0, 1, 2, 7], "pretti": [0, 1], "small": [0, 2, 3], "clearli": 0, "visibl": 0, "The": [0, 1, 2, 4, 5, 6, 7], "were": 0, "measur": 0, "my": 0, "machin": [0, 1], "amd": 0, "ryzen": 0, "7": 0, "4700u": 0, "iter": [0, 7], "total": [0, 7], "rand_napi": 0, "20000000": 0, "1": [0, 1, 3, 4, 5, 7], "44": 0, "baselin": 0, "rand_koffi": 0, "2": [0, 3, 4, 5, 7], "60": 0, "x1": 0, "81": [0, 1], "rand_node_ffi": 0, "107": 0, "58": 0, "x75": 0, "intel": 0, "core": 0, "i5": 0, "4460": 0, "10": 0, "3": [0, 1, 3, 5, 7], "87": 0, "84": 0, "x42": 0, "similar": [0, 2], "which": [0, 1, 5, 6], "take": [0, 7], "string": [0, 1, 2, 4, 6], "paramet": [0, 3, 6, 7], "javascript": [0, 3, 7], "v8": [0, 2], "convers": [0, 7], "rel": 0, "slow": [0, 1], "heavi": 0, "atoi_napi": 0, "97": 0, "atoi_koffi": 0, "5": [0, 2, 7], "07": 0, "71": 0, "atoi_node_ffi": 0, "693": 0, "16": [0, 7], "x233": 0, "91": 0, "99": 0, "479": 0, "34": 0, "x161": 0, "cpu": 0, "imag": 0, "draw": 0, "much": [0, 1], "heavier": 0, "than": [0, 4], "thu": 0, "reduc": 0, "In": [0, 2, 7], "full": [0, 1, 7], "version": [0, 1, 2, 3, 7], "code": [0, 3, 4], "nativ": 0, "wrapper": 0, "raylib_cc": 0, "100": 0, "9": 0, "31": 0, "raylib_node_raylib": 0, "90": 0, "17": 0, "raylib_koffi": 0, "12": [0, 1], "86": 0, "38": 0, "raylib_node_ffi": 0, "35": 0, "76": 0, "x3": 0, "67": 0, "05": 0, "13": 0, "14": [0, 7], "39": 0, "63": 0, "x4": 0, "18": [0, 7], "open": [0, 2, 7], "consol": [0, 2, 4, 7], "go": [0, 1], "cnoke": [0, 1], "befor": [0, 7], "do": [0, 1, 7], "anyth": 0, "els": [0, 7], "cd": [0, 1], "onc": [0, 1, 2, 4, 6, 7], "done": [0, 1, 2, 7], "you": [0, 1, 2, 3, 5, 6, 7], "can": [0, 1, 2, 3, 4, 5, 6, 7], "each": [0, 1, 2, 7], "e": [0, 2, 7], "g": [0, 1, 2, 7], "build": [0, 3, 5, 7], "option": [0, 1, 2, 3, 7], "defin": [0, 7], "custom": 0, "number": [0, 4, 7], "10000000": 0, "repositori": 1, "name": [1, 2, 7], "luigi": 1, "monorepo": 1, "contain": [1, 7], "multipl": 1, "project": 1, "idea": 1, "http": [1, 3], "github": 1, "com": 1, "koromix": 1, "issu": [1, 2], "we": [1, 7], "provid": [1, 2, 7], "prebuilt": [1, 5], "binari": [1, 5], "packag": [1, 5], "npm": [1, 5, 6], "archiv": 1, "so": [1, 2, 6, 7], "most": [1, 2, 7], "should": 1, "instal": [1, 5, 6], "If": 1, "want": 1, "hack": 1, "specif": [1, 4], "follow": [1, 2, 5, 7], "instruct": [1, 2], "make": 1, "sure": 1, "depend": [1, 2, 7], "met": 1, "desktop": 1, "develop": 1, "workload": 1, "visual": 1, "studio": 1, "2022": 1, "2019": 1, "tool": 1, "default": [1, 2, 3, 7], "compon": 1, "cmake": 1, "meta": 1, "system": [1, 6], "later": [1, 3], "command": 1, "benchmark": [1, 3], "directori": [1, 7], "what": 1, "gcc": 1, "8": [1, 2, 7], "newer": 1, "gnu": [1, 3], "architectur": [1, 2, 3, 5, 7], "emul": 1, "acceler": 1, "when": [1, 2, 4, 7], "possibl": [1, 7], "qemu": 1, "need": [1, 2, 7], "even": 1, "gui": 1, "ubuntu": 1, "includ": [1, 2, 5, 7], "directli": [1, 7], "licens": 1, "size": [1, 3, 4], "reason": [1, 7], "thei": [1, 2, 7], "avail": [1, 4], "dev": 1, "file": [1, 2, 7], "For": [1, 2, 4, 5, 7], "exampl": [1, 3, 7], "debian": 1, "arm64": [1, 5], "wget": 1, "q": 1, "o": [1, 7], "qemu_debian_arm64": 1, "tar": 1, "zst": 1, "zstd": 1, "d": [1, 2, 7], "xv": 1, "sha256sum": 1, "ignor": [1, 2], "miss": 1, "registri": 1, "txt": 1, "note": [1, 7], "disk": 1, "content": [1, 7], "mai": 1, "chang": [1, 2, 4, 7], "checksum": 1, "fail": [1, 2, 7], "been": 1, "least": [1, 4], "And": [1, 6], "now": [1, 6, 7], "sever": [1, 2], "help": 1, "patient": 1, "linux": [1, 3, 5], "have": [1, 6, 7], "ccach": 1, "subsequ": [1, 4], "step": 1, "get": [1, 4, 6, 7], "more": [1, 2, 3, 4, 7], "toler": 1, "By": [1, 2, 7], "start": [1, 2, 3], "stop": 1, "But": [1, 7], "ahead": 1, "instead": [1, 7], "without": [1, 5], "shut": 1, "down": 1, "again": 1, "everyth": 1, "also": [1, 7], "restrict": 1, "subset": 1, "cycl": 1, "debian_x64": 1, "debian_i386": 1, "separ": 1, "shutdown": 1, "final": [1, 7], "join": 1, "ssh": 1, "shortcut": 1, "some": [1, 7], "debug": 1, "ani": [1, 3, 7], "manual": 1, "procedur": [1, 2], "configur": 1, "vnc": 1, "server": 1, "local": [1, 6], "access": 1, "displai": 1, "krdc": 1, "compat": 1, "viewer": 1, "info": 1, "port": 1, "after": [1, 2], "releas": 1, "0": [1, 2, 3, 7], "current": [1, 6, 7], "prioriti": 1, "next": [1, 7], "major": 1, "autom": 1, "aarch64": [1, 5], "maco": [1, 5], "how": [1, 2, 3, 7], "creat": [1, 2, 7], "real": 1, "world": [1, 2, 6, 7], "librari": [1, 2, 6, 7], "raylib": [1, 3], "sqlite": [1, 2], "libsodium": 1, "illustr": [1, 6, 7], "work": [1, 3], "variou": 1, "style": [1, 2], "plan": 1, "eventu": 1, "necessarili": 1, "order": [1, 2], "optim": 1, "pass": [1, 2, 7], "struct": [1, 3, 4, 6], "arrai": [1, 3], "hfa": 1, "helper": 1, "add": [1, 7], "type": [1, 2, 3, 6], "parser": [1, 2], "wai": [1, 6, 7], "encod": [1, 7], "decod": 1, "byte": [1, 4, 7], "support": [1, 2, 3, 7], "union": 1, "better": 1, "automat": [1, 2], "deal": [1, 7], "caller": 1, "heap": [1, 4], "alloc": [1, 4, 7], "memori": [1, 2, 3, 7], "etc": [1, 2], "powerpc": 1, "power9": 1, "abi": [1, 5, 7], "To": 2, "declar": [2, 6, 7], "load": [2, 6, 7], "share": [2, 6, 7], "const": [2, 6, 7], "requir": [2, 6, 7], "lib": [2, 6, 7], "path": [2, 7], "extens": 2, "platform": [2, 3, 4, 7], "dll": [2, 6, 7], "dylib": 2, "return": [2, 7], "object": [2, 4, 7], "from": [2, 3, 5, 7], "two": [2, 4, 7], "inspir": 2, "specifi": [2, 7], "its": [2, 7], "non": [2, 7], "mangl": 2, "ellipsi": 2, "last": [2, 7], "printf": [2, 6], "func": [2, 6, 7], "int": [2, 6, 7], "atoi": [2, 3], "tri": 2, "x86": [2, 5, 6], "convent": [2, 5, 6], "see": [2, 3, 7], "section": [2, 7], "inform": [2, 3, 7], "subject": 2, "shown": 2, "char": [2, 6, 7], "fmt": 2, "happen": [2, 4, 7], "onli": [2, 5, 7], "per": 2, "process": 2, "32": 2, "bit": 2, "except": 2, "form": 2, "descript": [2, 4], "cdecl": [2, 5], "other": [2, 7], "stdcall": [2, 5, 6], "__stdcall": [2, 7], "within": 2, "win32": [2, 6, 7], "fastcal": [2, 5], "__fastcal": 2, "rare": [2, 7], "ecx": 2, "edx": 2, "thiscal": [2, 5], "__thiscal": 2, "safe": 2, "simpli": [2, 7], "find": [2, 3, 6, 7], "show": [2, 6, 7], "user32": [2, 6], "equival": [2, 7], "messageboxa_1": 2, "messageboxa": [2, 6], "void": [2, 6, 7], "uint": [2, 6, 7], "messageboxa_2": 2, "hwnd": 2, "text": 2, "caption": 2, "async": 2, "member": [2, 7], "argument": [2, 7], "err": 2, "re": 2, "libc": [2, 6], "6": [2, 6, 7], "str": [2, 7], "1257": 2, "log": [2, 4, 7], "result": [2, 3, 6, 7], "hello": [2, 6, 7], "program": [2, 3], "print": [2, 6, 7], "easili": 2, "convert": [2, 7], "promis": 2, "util": 2, "promisifi": 2, "cannot": [2, 7], "must": 2, "addit": [2, 7], "expect": [2, 5, 7], "valu": [2, 3, 6, 7], "doubl": [2, 5, 7], "THE": 2, "end": 2, "integ": [2, 7], "s": [2, 7], "On": 2, "forward": [2, 5], "howev": [2, 7], "mani": [2, 7], "pointer": [2, 3], "input": [2, 7], "simplici": 2, "semant": [2, 7], "primit": [2, 3], "marshal": 2, "out": [2, 7], "timev": [2, 6], "where": [2, 7], "inout": 2, "dual": 2, "same": [2, 4, 7], "msdn": 2, "qualifi": 2, "_out_": [2, 6, 7], "_inout_": [2, 7], "posix": 2, "gettimeofdai": [2, 6], "tv_sec": [2, 6], "unsign": [2, 6, 7], "tv_usec": [2, 6], "timezon": [2, 6], "tz_minuteswest": [2, 6], "tz_dsttime": [2, 6], "tv": [2, 6], "tz": [2, 6], "let": [2, 4, 6, 7], "null": [2, 6, 7], "databas": 2, "sqlite3_db": 2, "copi": [2, 7], "sqlite3_open_v2": 2, "sqlite_open_readwrit": 2, "0x2": 2, "sqlite_open_cr": 2, "0x4": 2, "db": 2, "throw": [2, 7], "new": [2, 4, 7], "error": [2, 7], "sqlite3_close_v2": 2, "With": 2, "noth": 2, "examplecallback": 2, "float": [2, 5, 7], "sum": [2, 7], "adddoublefloat": 2, "f": [2, 7], "your": [2, 3], "them": [2, 7], "part": 2, "h": [2, 7], "transfertoj": 2, "ag": 2, "cb": 2, "buf": 2, "64": [2, 5, 7], "snprintf": 2, "sizeof": [2, 7], "transfercallback": 2, "ret": 2, "niel": 2, "27": 2, "42": [2, 7], "main": 2, "precis": [2, 5], "intepret": 2, "anoth": [2, 7], "undefin": 2, "behavior": [2, 7], "lead": 2, "mess": [2, 7], "fast": 3, "easi": 3, "featur": 3, "low": 3, "perform": 3, "aggreg": 3, "data": 3, "fix": 3, "both": [3, 7], "callback": [3, 4, 5, 7], "sinc": 3, "well": 3, "popular": 3, "os": [3, 5, 7], "combin": [3, 5], "window": [3, 5], "introspect": 3, "definit": [3, 7], "synchron": [3, 4], "asynchron": [3, 4], "variad": [3, 6], "output": [3, 6, 7], "usag": 3, "set": 3, "rand": 3, "run": [3, 6], "contribut": 3, "bug": 3, "request": 3, "sourc": [3, 5], "todo": 3, "list": [3, 7], "free": [3, 7], "softwar": 3, "redistribut": 3, "modifi": [3, 7], "under": 3, "term": 3, "affero": 3, "gener": [3, 7], "public": 3, "publish": 3, "foundat": 3, "either": [3, 7], "www": 3, "org": 3, "normal": [4, 7], "prealloc": 4, "block": 4, "One": 4, "construct": 4, "assign": [4, 7], "stack": 4, "assembl": 4, "mib": 4, "big": [4, 7], "unless": 4, "veri": 4, "page": 4, "extra": 4, "ever": 4, "dure": 4, "config": 4, "obj": 4, "appli": [4, 7], "true": [4, 7], "made": 4, "unus": 4, "resid": 4, "still": 4, "finish": 4, "freed": 4, "resident_async_pool": 4, "left": 4, "sync_stack_s": 4, "sync_heap_s": 4, "async_stack_s": 4, "512": 4, "kib": 4, "async_heap_s": 4, "pool": 4, "moment": 5, "isa": 5, "freebsd": 5, "openbsd": 5, "ia32": 5, "ye": 5, "A": [5, 7], "x86_64": 5, "amd64": 5, "arm32": 5, "le": [5, 7], "probabl": 5, "risc": 5, "v": 5, "all": [5, 7], "fulli": 5, "green": 5, "check": 5, "mark": 5, "mean": [5, 7], "compil": 5, "ms": 5, "hard": 5, "vfp": 5, "coprocessor": 5, "differ": [5, 7], "softfp": 5, "soft": 5, "lp64d": 5, "lp64": [5, 7], "theori": 5, "untest": 5, "lp64f": 5, "like": [6, 7], "prototyp": 6, "languag": 6, "syntax": 6, "It": [6, 7], "time_t": 6, "int64_t": [6, 7], "tm": 6, "tm_sec": 6, "tm_min": 6, "tm_hour": 6, "tm_mdai": 6, "tm_mon": 6, "tm_year": 6, "tm_wdai": 6, "tm_ydai": 6, "tm_isdst": 6, "localtime_r": 6, "format": 6, "02d": 6, "target": 6, "messagebox": 6, "messag": 6, "user": [6, 7], "constant": 6, "mb_iconinform": 6, "0x40": 6, "foobar": 6, "while": 7, "allow": 7, "variat": 7, "enforc": 7, "signed": 7, "valid": 7, "int8": 7, "sign": 7, "int8_t": 7, "uint8": 7, "uint8_t": 7, "uchar": 7, "char16": 7, "char16_t": 7, "int16": 7, "int16_t": 7, "uint16": 7, "uint16_t": 7, "short": 7, "int32": 7, "4": 7, "int32_t": 7, "uint32": 7, "uint32_t": 7, "int64": 7, "uint64": 7, "uint64_t": 7, "longlong": 7, "long": 7, "ulonglong": 7, "float32": 7, "float64": 7, "few": 7, "boolean": 7, "bool": 7, "usual": 7, "llp64": 7, "ulong": 7, "utf": 7, "string16": 7, "line": 7, "struct1": 7, "dummi": 7, "struct2": 7, "vice": 7, "versa": 7, "unlik": 7, "omit": 7, "anonym": 7, "typedef": 7, "b": 7, "d1": 7, "d2": 7, "rule": 7, "regard": 7, "align": 7, "pad": 7, "latter": 7, "function1": 7, "function2": 7, "differenti": 7, "purpos": 7, "import": 7, "distinguish": 7, "fall": 7, "avoid": 7, "potenti": 7, "expens": 7, "doe": 7, "expos": 7, "sqlite3_stmt": 7, "someth": 7, "stabil": 7, "prevent": 7, "intern": 7, "dynam": 7, "termin": 7, "length": 7, "lot": 7, "getcursorpo": 7, "retriev": 7, "cursor": 7, "posit": 7, "kernel32": 7, "point": 7, "x": 7, "y": 7, "po": 7, "kind": 7, "orient": 7, "pair": 7, "dedic": 7, "delet": 7, "obviou": 7, "found": 7, "stdio": 7, "fopen": 7, "fclose": 7, "manipul": 7, "fread": 7, "ftell": 7, "manag": 7, "builder": 7, "concaten": 7, "mix": 7, "fizzbuzz": 7, "hidden": 7, "behind": 7, "destroi": 7, "concatnew": 7, "concatnewout": 7, "concatfre": 7, "clang": 7, "fpic": 7, "wall": 7, "o2": 7, "stdlib": 7, "stdbool": 7, "errno": 7, "fragment": 7, "size_t": 7, "len": 7, "concat": 7, "malloc": 7, "fprintf": 7, "stderr": 7, "strerror": 7, "fals": 7, "concatappend": 7, "frag": 7, "strlen": 7, "memcpi": 7, "concatbuild": 7, "r": 7, "stupid": 7, "try": 7, "failur": 7, "i": 7, "30": 7, "15": 7, "buzz": 7, "fizz": 7, "infer": 7, "itself": 7, "sentinel": 7, "translat": 7, "typedarrai": 7, "proper": 7, "notion": 7, "fat": 7, "yourself": 7, "calcul": 7, "stdint": 7, "computetotallength": 7, "ptr": 7, "14n": 7, "just": 7, "direct": 7, "document": 7, "findfirstfilew": 7, "findnextfilew": 7, "filetim": 7, "dwlowdatetim": 7, "dwhighdatetim": 7, "win32_find_data": 7, "dwfileattribut": 7, "ftcreationtim": 7, "ftlastaccesstim": 7, "ftlastwritetim": 7, "nfilesizehigh": 7, "nfilesizelow": 7, "dwreserved0": 7, "dwreserved1": 7, "cfilenam": 7, "260": 7, "calternatefilenam": 7, "dwfiletyp": 7, "obsolet": 7, "dwcreatortyp": 7, "wfinderflag": 7, "ushort": 7, "findfirstfil": 7, "findnextfil": 7, "findclos": 7, "getlasterror": 7, "dirnam": 7, "filenam": 7, "error_file_not_found": 7, "push": 7, "error_no_more_fil": 7, "among": 7, "variabl": 7, "invol": 7, "list1": 7, "list2": 7, "thank": 7, "transpar": 7, "approxim": 7, "singl": 7, "element": 7, "store": 7, "addint": 7, "dest": 7, "36": 7, "degener": 7, "emb": 7, "correct": 7, "uint8arrai": 7, "hint": 7, "those": 7, "exactli": 7, "foo1": 7, "foo": 7, "a16": 7, "foo2": 7, "hypothet": 7, "returnfoo1": 7, "returnfoo": 7, "p": 7, "returnfoo2": 7, "int16arrai": 7, "fill": 7, "truncat": 7, "buffer": 7, "alwai": 7, "nul": 7, "revers": 7, "explicitli": 7, "ask": 7, "explor": 7, "alignof": 7}, "objects": {}, "objtypes": {}, "objnames": {}, "titleterms": {"benchmark": 0, "rand": 0, "result": 0, "linux": [0, 6], "x86_64": 0, "window": [0, 1, 6], "atoi": 0, "raylib": 0, "run": [0, 1], "contribut": 1, "bug": 1, "featur": 1, "request": 1, "build": 1, "from": 1, "sourc": 1, "other": 1, "platform": [1, 5], "test": 1, "todo": 1, "list": 1, "function": 2, "call": 2, "definit": 2, "classic": 2, "syntax": 2, "c": [2, 7], "like": 2, "prototyp": 2, "synchron": 2, "asynchron": 2, "variad": 2, "output": 2, "paramet": 2, "struct": [2, 7], "exampl": [2, 6], "opaqu": [2, 7], "handl": [2, 7], "javascript": 2, "callback": 2, "us": 2, "thread": 2, "safeti": 2, "koffi": 3, "overview": 3, "tabl": 3, "content": 3, "licens": 3, "memori": 4, "usag": 4, "how": 4, "work": 4, "default": 4, "set": 4, "support": 5, "quick": 6, "start": 6, "small": 6, "data": 7, "type": 7, "primit": 7, "pointer": 7, "arrai": 7, "fix": 7, "size": 7, "string": 7, "introspect": 7}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 6, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 56}})
|
|
1
|
+
Search.setIndex({"docnames": ["benchmarks", "contribute", "functions", "index", "memory", "platforms", "start", "types"], "filenames": ["benchmarks.md", "contribute.md", "functions.md", "index.rst", "memory.md", "platforms.md", "start.md", "types.md"], "titles": ["Benchmarks", "Contributing", "Function calls", "Koffi 1.3.2", "Memory usage", "Supported platforms", "Quick start", "Data types"], "terms": {"here": [0, 1, 2, 3, 7], "quick": [0, 3], "overview": 0, "execut": 0, "time": [0, 1, 6], "koffi": [0, 1, 2, 4, 5, 6, 7], "call": [0, 3, 4, 5, 6, 7], "three": [0, 6, 7], "test": [0, 3, 5], "case": [0, 1, 2, 7], "one": [0, 2, 4, 6, 7], "base": [0, 2, 3, 7], "around": [0, 4, 7], "compar": 0, "theoret": 0, "ideal": 0, "implement": [0, 7], "These": [0, 1, 7], "ar": [0, 1, 2, 4, 5, 6, 7], "detail": 0, "explain": 0, "below": [0, 1, 2, 6, 7], "node": [0, 1, 2, 3, 6], "ffi": [0, 2, 3, 6], "napi": 0, "thi": [0, 1, 2, 3, 6, 7], "repeat": 0, "simpl": [0, 1, 2, 7], "standard": [0, 2, 7], "c": [0, 1, 3, 4, 5, 6], "function": [0, 1, 3, 6, 7], "ha": [0, 1, 2, 7], "first": [0, 1, 2, 6, 7], "refer": [0, 3, 7], "through": [0, 2, 7], "an": [0, 2, 4, 7], "n": [0, 5, 6, 7], "api": [0, 1, 2, 6, 7], "modul": [0, 3], "close": [0, 7], "limit": 0, "perfect": 0, "overhead": [0, 3], "js": [0, 1, 2, 3, 5, 7], "second": [0, 2, 6, 7], "third": [0, 7], "us": [0, 1, 3, 4, 5, 6, 7], "offici": [0, 1, 5], "becaus": [0, 1, 2, 7], "pretti": [0, 1], "small": [0, 2, 3], "clearli": 0, "visibl": 0, "The": [0, 1, 2, 4, 5, 6, 7], "were": 0, "measur": 0, "my": 0, "machin": [0, 1], "amd": 0, "ryzen": 0, "7": 0, "4700u": 0, "iter": [0, 7], "total": [0, 7], "rand_napi": 0, "20000000": 0, "1": [0, 1, 4, 5, 7], "44": 0, "baselin": 0, "rand_koffi": 0, "2": [0, 4, 5, 7], "60": 0, "x1": 0, "81": [0, 1], "rand_node_ffi": 0, "107": 0, "58": 0, "x75": 0, "intel": 0, "core": 0, "i5": 0, "4460": 0, "10": 0, "3": [0, 1, 5, 7], "87": 0, "84": 0, "x42": 0, "similar": [0, 2], "which": [0, 1, 5, 6], "take": [0, 7], "string": [0, 1, 2, 4, 6], "paramet": [0, 3, 6, 7], "javascript": [0, 3, 7], "v8": [0, 2], "convers": [0, 7], "rel": 0, "slow": [0, 1], "heavi": 0, "atoi_napi": 0, "97": 0, "atoi_koffi": 0, "5": [0, 2, 7], "07": 0, "71": 0, "atoi_node_ffi": 0, "693": 0, "16": [0, 7], "x233": 0, "91": 0, "99": 0, "479": 0, "34": 0, "x161": 0, "cpu": 0, "imag": 0, "draw": 0, "much": [0, 1], "heavier": 0, "than": [0, 4], "thu": 0, "reduc": 0, "In": [0, 2, 7], "full": [0, 1, 7], "version": [0, 1, 2, 3, 7], "code": [0, 3, 4], "nativ": 0, "wrapper": 0, "raylib_cc": 0, "100": 0, "9": 0, "31": 0, "raylib_node_raylib": 0, "90": 0, "17": 0, "raylib_koffi": 0, "12": [0, 1], "86": 0, "38": 0, "raylib_node_ffi": 0, "35": 0, "76": 0, "x3": 0, "67": 0, "05": 0, "13": 0, "14": [0, 7], "39": 0, "63": 0, "x4": 0, "18": [0, 7], "open": [0, 2, 7], "consol": [0, 2, 4, 7], "go": [0, 1], "cnoke": [0, 1], "befor": [0, 7], "do": [0, 1, 7], "anyth": 0, "els": [0, 7], "cd": [0, 1], "onc": [0, 1, 2, 4, 6, 7], "done": [0, 1, 2, 7], "you": [0, 1, 2, 3, 5, 6, 7], "can": [0, 1, 2, 3, 4, 5, 6, 7], "each": [0, 1, 2, 7], "e": [0, 2, 7], "g": [0, 1, 2, 7], "build": [0, 3, 5, 7], "option": [0, 1, 2, 3, 7], "defin": [0, 7], "custom": 0, "number": [0, 4, 7], "10000000": 0, "repositori": 1, "name": [1, 2, 7], "luigi": 1, "monorepo": 1, "contain": [1, 7], "multipl": 1, "project": 1, "idea": 1, "http": [1, 3], "github": 1, "com": 1, "koromix": 1, "issu": [1, 2], "we": [1, 7], "provid": [1, 2, 7], "prebuilt": [1, 5], "binari": [1, 5], "packag": [1, 5], "npm": [1, 5, 6], "archiv": 1, "so": [1, 2, 6, 7], "most": [1, 2, 7], "should": 1, "instal": [1, 5, 6], "If": 1, "want": 1, "hack": 1, "specif": [1, 4], "follow": [1, 2, 5, 7], "instruct": [1, 2], "make": 1, "sure": 1, "depend": [1, 2, 7], "met": 1, "desktop": 1, "develop": 1, "workload": 1, "visual": 1, "studio": 1, "2022": 1, "2019": 1, "tool": 1, "default": [1, 2, 3, 7], "compon": 1, "cmake": 1, "meta": 1, "system": [1, 6], "later": [1, 3], "command": 1, "benchmark": [1, 3], "directori": [1, 7], "what": 1, "gcc": 1, "8": [1, 2, 7], "newer": 1, "gnu": [1, 3], "architectur": [1, 2, 3, 5, 7], "emul": 1, "acceler": 1, "when": [1, 2, 4, 7], "possibl": [1, 7], "qemu": 1, "need": [1, 2, 7], "even": 1, "gui": 1, "ubuntu": 1, "includ": [1, 2, 5, 7], "directli": [1, 7], "licens": 1, "size": [1, 3, 4], "reason": [1, 7], "thei": [1, 2, 7], "avail": [1, 4], "dev": 1, "file": [1, 2, 7], "For": [1, 2, 4, 5, 7], "exampl": [1, 3, 7], "debian": 1, "arm64": [1, 5], "wget": 1, "q": 1, "o": [1, 7], "qemu_debian_arm64": 1, "tar": 1, "zst": 1, "zstd": 1, "d": [1, 2, 7], "xv": 1, "sha256sum": 1, "ignor": [1, 2], "miss": 1, "registri": 1, "txt": 1, "note": [1, 7], "disk": 1, "content": [1, 7], "mai": 1, "chang": [1, 2, 4, 7], "checksum": 1, "fail": [1, 2, 7], "been": 1, "least": [1, 4], "And": [1, 6], "now": [1, 6, 7], "sever": [1, 2], "help": 1, "patient": 1, "linux": [1, 3, 5], "have": [1, 6, 7], "ccach": 1, "subsequ": [1, 4], "step": 1, "get": [1, 4, 6, 7], "more": [1, 2, 3, 4, 7], "toler": 1, "By": [1, 2, 7], "start": [1, 2, 3], "stop": 1, "But": [1, 7], "ahead": 1, "instead": [1, 7], "without": [1, 5], "shut": 1, "down": 1, "again": 1, "everyth": 1, "also": [1, 7], "restrict": 1, "subset": 1, "cycl": 1, "debian_x64": 1, "debian_i386": 1, "separ": 1, "shutdown": 1, "final": [1, 7], "join": 1, "ssh": 1, "shortcut": 1, "some": [1, 7], "debug": 1, "ani": [1, 3, 7], "manual": 1, "procedur": [1, 2], "configur": 1, "vnc": 1, "server": 1, "local": [1, 6], "access": 1, "displai": 1, "krdc": 1, "compat": 1, "viewer": 1, "info": 1, "port": 1, "after": [1, 2], "releas": 1, "0": [1, 2, 3, 7], "current": [1, 6, 7], "prioriti": 1, "next": [1, 7], "major": 1, "autom": 1, "aarch64": [1, 5], "maco": [1, 5], "how": [1, 2, 3, 7], "creat": [1, 2, 7], "real": 1, "world": [1, 2, 6, 7], "librari": [1, 2, 6, 7], "raylib": [1, 3], "sqlite": [1, 2], "libsodium": 1, "illustr": [1, 6, 7], "work": [1, 3], "variou": 1, "style": [1, 2], "plan": 1, "eventu": 1, "necessarili": 1, "order": [1, 2], "optim": 1, "pass": [1, 2, 7], "struct": [1, 3, 4, 6], "arrai": [1, 3], "hfa": 1, "helper": 1, "add": [1, 7], "type": [1, 2, 3, 6], "parser": [1, 2], "wai": [1, 6, 7], "encod": [1, 7], "decod": 1, "byte": [1, 4, 7], "support": [1, 2, 3, 7], "union": 1, "better": 1, "automat": [1, 2], "deal": [1, 7], "caller": 1, "heap": [1, 4], "alloc": [1, 4, 7], "memori": [1, 2, 3, 7], "etc": [1, 2], "powerpc": 1, "power9": 1, "abi": [1, 5, 7], "To": 2, "declar": [2, 6, 7], "load": [2, 6, 7], "share": [2, 6, 7], "const": [2, 6, 7], "requir": [2, 6, 7], "lib": [2, 6, 7], "path": [2, 7], "extens": 2, "platform": [2, 3, 4, 7], "dll": [2, 6, 7], "dylib": 2, "return": [2, 7], "object": [2, 4, 7], "from": [2, 3, 5, 7], "two": [2, 4, 7], "inspir": 2, "specifi": [2, 7], "its": [2, 7], "non": [2, 7], "mangl": 2, "ellipsi": 2, "last": [2, 7], "printf": [2, 6], "func": [2, 6, 7], "int": [2, 6, 7], "atoi": [2, 3], "tri": 2, "x86": [2, 5, 6], "convent": [2, 5, 6], "see": [2, 3, 7], "section": [2, 7], "inform": [2, 3, 7], "subject": 2, "shown": 2, "char": [2, 6, 7], "fmt": 2, "happen": [2, 4, 7], "onli": [2, 5, 7], "per": 2, "process": 2, "32": 2, "bit": 2, "except": 2, "form": 2, "descript": [2, 4], "cdecl": [2, 5], "other": [2, 7], "stdcall": [2, 5, 6], "__stdcall": [2, 7], "within": 2, "win32": [2, 6, 7], "fastcal": [2, 5], "__fastcal": 2, "rare": [2, 7], "ecx": 2, "edx": 2, "thiscal": [2, 5], "__thiscal": 2, "safe": 2, "simpli": [2, 7], "find": [2, 3, 6, 7], "show": [2, 6, 7], "user32": [2, 6], "equival": [2, 7], "messageboxa_1": 2, "messageboxa": [2, 6], "void": [2, 6, 7], "uint": [2, 6, 7], "messageboxa_2": 2, "hwnd": 2, "text": 2, "caption": 2, "async": 2, "member": [2, 7], "argument": [2, 7], "err": 2, "re": 2, "libc": [2, 6], "6": [2, 6, 7], "str": [2, 7], "1257": 2, "log": [2, 4, 7], "result": [2, 3, 6, 7], "hello": [2, 6, 7], "program": [2, 3], "print": [2, 6, 7], "easili": 2, "convert": [2, 7], "promis": 2, "util": 2, "promisifi": 2, "cannot": [2, 7], "must": 2, "addit": [2, 7], "expect": [2, 5, 7], "valu": [2, 3, 6, 7], "doubl": [2, 5, 7], "THE": 2, "end": 2, "integ": [2, 7], "s": [2, 7], "On": 2, "forward": [2, 5], "howev": [2, 7], "mani": [2, 7], "pointer": [2, 3], "input": [2, 7], "simplici": 2, "semant": [2, 7], "primit": [2, 3], "marshal": 2, "out": [2, 7], "timev": [2, 6], "where": [2, 7], "inout": 2, "dual": 2, "same": [2, 4, 7], "msdn": 2, "qualifi": 2, "_out_": [2, 6, 7], "_inout_": [2, 7], "posix": 2, "gettimeofdai": [2, 6], "tv_sec": [2, 6], "unsign": [2, 6, 7], "tv_usec": [2, 6], "timezon": [2, 6], "tz_minuteswest": [2, 6], "tz_dsttime": [2, 6], "tv": [2, 6], "tz": [2, 6], "let": [2, 4, 6, 7], "null": [2, 6, 7], "databas": 2, "sqlite3_db": 2, "copi": [2, 7], "sqlite3_open_v2": 2, "sqlite_open_readwrit": 2, "0x2": 2, "sqlite_open_cr": 2, "0x4": 2, "db": 2, "throw": [2, 7], "new": [2, 4, 7], "error": [2, 7], "sqlite3_close_v2": 2, "With": 2, "noth": 2, "examplecallback": 2, "float": [2, 5, 7], "sum": [2, 7], "adddoublefloat": 2, "f": [2, 7], "your": [2, 3], "them": [2, 7], "part": 2, "h": [2, 7], "transfertoj": 2, "ag": 2, "cb": 2, "buf": 2, "64": [2, 5, 7], "snprintf": 2, "sizeof": [2, 7], "transfercallback": 2, "ret": 2, "niel": 2, "27": 2, "42": [2, 7], "main": 2, "precis": [2, 5], "intepret": 2, "anoth": [2, 7], "undefin": 2, "behavior": [2, 7], "lead": 2, "mess": [2, 7], "fast": 3, "easi": 3, "featur": 3, "low": 3, "perform": 3, "aggreg": 3, "data": 3, "fix": 3, "both": [3, 7], "callback": [3, 4, 5, 7], "sinc": 3, "well": 3, "popular": 3, "os": [3, 5, 7], "combin": [3, 5], "window": [3, 5], "introspect": 3, "definit": [3, 7], "synchron": [3, 4], "asynchron": [3, 4], "variad": [3, 6], "output": [3, 6, 7], "usag": 3, "set": 3, "rand": 3, "run": [3, 6], "contribut": 3, "bug": 3, "request": 3, "sourc": [3, 5], "todo": 3, "list": [3, 7], "free": [3, 7], "softwar": 3, "redistribut": 3, "modifi": [3, 7], "under": 3, "term": 3, "affero": 3, "gener": [3, 7], "public": 3, "publish": 3, "foundat": 3, "either": [3, 7], "www": 3, "org": 3, "normal": [4, 7], "prealloc": 4, "block": 4, "One": 4, "construct": 4, "assign": [4, 7], "stack": 4, "assembl": 4, "mib": 4, "big": [4, 7], "unless": 4, "veri": 4, "page": 4, "extra": 4, "ever": 4, "dure": 4, "config": 4, "obj": 4, "appli": [4, 7], "true": [4, 7], "made": 4, "unus": 4, "resid": 4, "still": 4, "finish": 4, "freed": 4, "resident_async_pool": 4, "left": 4, "sync_stack_s": 4, "sync_heap_s": 4, "async_stack_s": 4, "512": 4, "kib": 4, "async_heap_s": 4, "pool": 4, "moment": 5, "isa": 5, "freebsd": 5, "openbsd": 5, "ia32": 5, "ye": 5, "A": [5, 7], "x86_64": 5, "amd64": 5, "arm32": 5, "le": [5, 7], "probabl": 5, "risc": 5, "v": 5, "all": [5, 7], "fulli": 5, "green": 5, "check": 5, "mark": 5, "mean": [5, 7], "compil": 5, "ms": 5, "hard": 5, "vfp": 5, "coprocessor": 5, "differ": [5, 7], "softfp": 5, "soft": 5, "lp64d": 5, "lp64": [5, 7], "theori": 5, "untest": 5, "lp64f": 5, "like": [6, 7], "prototyp": 6, "languag": 6, "syntax": 6, "It": [6, 7], "time_t": 6, "int64_t": [6, 7], "tm": 6, "tm_sec": 6, "tm_min": 6, "tm_hour": 6, "tm_mdai": 6, "tm_mon": 6, "tm_year": 6, "tm_wdai": 6, "tm_ydai": 6, "tm_isdst": 6, "localtime_r": 6, "format": 6, "02d": 6, "target": 6, "messagebox": 6, "messag": 6, "user": [6, 7], "constant": 6, "mb_iconinform": 6, "0x40": 6, "foobar": 6, "while": 7, "allow": 7, "variat": 7, "enforc": 7, "signed": 7, "valid": 7, "int8": 7, "sign": 7, "int8_t": 7, "uint8": 7, "uint8_t": 7, "uchar": 7, "char16": 7, "char16_t": 7, "int16": 7, "int16_t": 7, "uint16": 7, "uint16_t": 7, "short": 7, "int32": 7, "4": 7, "int32_t": 7, "uint32": 7, "uint32_t": 7, "int64": 7, "uint64": 7, "uint64_t": 7, "longlong": 7, "long": 7, "ulonglong": 7, "float32": 7, "float64": 7, "few": 7, "boolean": 7, "bool": 7, "usual": 7, "llp64": 7, "ulong": 7, "utf": 7, "string16": 7, "line": 7, "struct1": 7, "dummi": 7, "struct2": 7, "vice": 7, "versa": 7, "unlik": 7, "omit": 7, "anonym": 7, "typedef": 7, "b": 7, "d1": 7, "d2": 7, "rule": 7, "regard": 7, "align": 7, "pad": 7, "latter": 7, "function1": 7, "function2": 7, "differenti": 7, "purpos": 7, "import": 7, "distinguish": 7, "fall": 7, "avoid": 7, "potenti": 7, "expens": 7, "doe": 7, "expos": 7, "sqlite3_stmt": 7, "someth": 7, "stabil": 7, "prevent": 7, "intern": 7, "dynam": 7, "termin": 7, "length": 7, "lot": 7, "getcursorpo": 7, "retriev": 7, "cursor": 7, "posit": 7, "kernel32": 7, "point": 7, "x": 7, "y": 7, "po": 7, "kind": 7, "orient": 7, "pair": 7, "dedic": 7, "delet": 7, "obviou": 7, "found": 7, "stdio": 7, "fopen": 7, "fclose": 7, "manipul": 7, "fread": 7, "ftell": 7, "manag": 7, "builder": 7, "concaten": 7, "mix": 7, "fizzbuzz": 7, "hidden": 7, "behind": 7, "destroi": 7, "concatnew": 7, "concatnewout": 7, "concatfre": 7, "clang": 7, "fpic": 7, "wall": 7, "o2": 7, "stdlib": 7, "stdbool": 7, "errno": 7, "fragment": 7, "size_t": 7, "len": 7, "concat": 7, "malloc": 7, "fprintf": 7, "stderr": 7, "strerror": 7, "fals": 7, "concatappend": 7, "frag": 7, "strlen": 7, "memcpi": 7, "concatbuild": 7, "r": 7, "stupid": 7, "try": 7, "failur": 7, "i": 7, "30": 7, "15": 7, "buzz": 7, "fizz": 7, "infer": 7, "itself": 7, "sentinel": 7, "translat": 7, "typedarrai": 7, "proper": 7, "notion": 7, "fat": 7, "yourself": 7, "calcul": 7, "stdint": 7, "computetotallength": 7, "ptr": 7, "14n": 7, "just": 7, "direct": 7, "document": 7, "findfirstfilew": 7, "findnextfilew": 7, "filetim": 7, "dwlowdatetim": 7, "dwhighdatetim": 7, "win32_find_data": 7, "dwfileattribut": 7, "ftcreationtim": 7, "ftlastaccesstim": 7, "ftlastwritetim": 7, "nfilesizehigh": 7, "nfilesizelow": 7, "dwreserved0": 7, "dwreserved1": 7, "cfilenam": 7, "260": 7, "calternatefilenam": 7, "dwfiletyp": 7, "obsolet": 7, "dwcreatortyp": 7, "wfinderflag": 7, "ushort": 7, "findfirstfil": 7, "findnextfil": 7, "findclos": 7, "getlasterror": 7, "dirnam": 7, "filenam": 7, "error_file_not_found": 7, "push": 7, "error_no_more_fil": 7, "among": 7, "variabl": 7, "invol": 7, "list1": 7, "list2": 7, "thank": 7, "transpar": 7, "approxim": 7, "singl": 7, "element": 7, "store": 7, "addint": 7, "dest": 7, "36": 7, "degener": 7, "emb": 7, "correct": 7, "uint8arrai": 7, "hint": 7, "those": 7, "exactli": 7, "foo1": 7, "foo": 7, "a16": 7, "foo2": 7, "hypothet": 7, "returnfoo1": 7, "returnfoo": 7, "p": 7, "returnfoo2": 7, "int16arrai": 7, "fill": 7, "truncat": 7, "buffer": 7, "alwai": 7, "nul": 7, "revers": 7, "explicitli": 7, "ask": 7, "explor": 7, "alignof": 7}, "objects": {}, "objtypes": {}, "objnames": {}, "titleterms": {"benchmark": 0, "rand": 0, "result": 0, "linux": [0, 6], "x86_64": 0, "window": [0, 1, 6], "atoi": 0, "raylib": 0, "run": [0, 1], "contribut": 1, "bug": 1, "featur": 1, "request": 1, "build": 1, "from": 1, "sourc": 1, "other": 1, "platform": [1, 5], "test": 1, "todo": 1, "list": 1, "function": 2, "call": 2, "definit": 2, "classic": 2, "syntax": 2, "c": [2, 7], "like": 2, "prototyp": 2, "synchron": 2, "asynchron": 2, "variad": 2, "output": 2, "paramet": 2, "struct": [2, 7], "exampl": [2, 6], "opaqu": [2, 7], "handl": [2, 7], "javascript": 2, "callback": 2, "us": 2, "thread": 2, "safeti": 2, "koffi": 3, "overview": 3, "tabl": 3, "content": 3, "licens": 3, "memori": 4, "usag": 4, "how": 4, "work": 4, "default": 4, "set": 4, "support": 5, "quick": 6, "start": 6, "small": 6, "data": 7, "type": 7, "primit": 7, "pointer": 7, "arrai": 7, "fix": 7, "size": 7, "string": 7, "introspect": 7, "1": 3, "2": 3, "4": [], "3": 3, "0": [], "rc": []}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 6, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 56}})
|
package/doc/index.rst
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koffi",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foreign",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"author": "Niels Martignène <niels.martignene@protonmail.com>",
|
|
20
20
|
"main": "src/index.js",
|
|
21
21
|
"scripts": {
|
|
22
|
-
"install": "cnoke --prebuild build/qemu/{{version}}/koffi_{{platform}}_{{arch}}.tar.gz",
|
|
22
|
+
"install": "cnoke --prebuild build/qemu/{{version}}/koffi_{{platform}}_{{arch}}.tar.gz --require ./build/koffi.node",
|
|
23
23
|
"test": "node qemu/qemu.js",
|
|
24
24
|
"prepublishOnly": "node qemu/qemu.js pack"
|
|
25
25
|
},
|
|
26
26
|
"license": "AGPL-3.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"cnoke": "^2.0.
|
|
28
|
+
"cnoke": "^2.0.3"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"chalk": "^4.1.2",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"vendor",
|
|
57
57
|
"LICENSE.txt",
|
|
58
58
|
"README.md",
|
|
59
|
+
"ChangeLog.md",
|
|
59
60
|
"CMakeLists.txt",
|
|
60
61
|
"build/qemu/*/*.tar.gz"
|
|
61
62
|
]
|
package/qemu/qemu.js
CHANGED
|
@@ -249,7 +249,7 @@ async function start(detach = true) {
|
|
|
249
249
|
let version = fs.existsSync(filename) ? parseInt(fs.readFileSync(filename).toString(), 10) : 0;
|
|
250
250
|
|
|
251
251
|
if (version != machine.qemu.version) {
|
|
252
|
-
log(machine, '
|
|
252
|
+
log(machine, 'Machine version mismatch', chalk.bold.gray('[ignore]'));
|
|
253
253
|
|
|
254
254
|
ignore.add(machine);
|
|
255
255
|
missing++;
|
package/src/abi_x64_sysv_fwd.S
CHANGED
|
@@ -35,13 +35,15 @@
|
|
|
35
35
|
.global SYMBOL(ForwardCallXGD)
|
|
36
36
|
.global SYMBOL(ForwardCallXDD)
|
|
37
37
|
|
|
38
|
+
#define ENDBR64 .byte 0xf3, 0x0f, 0x1e, 0xfa
|
|
39
|
+
|
|
38
40
|
# Copy function pointer to R11, in order to save it through argument forwarding.
|
|
39
41
|
# Also make a copy of the SP to CallData::old_sp because the callback system might need it.
|
|
40
42
|
# Save RSP in RBX (non-volatile), and use carefully assembled stack provided by caller.
|
|
41
43
|
.macro prologue
|
|
42
44
|
.cfi_startproc
|
|
43
45
|
.cfi_def_cfa rsp, 8
|
|
44
|
-
|
|
46
|
+
ENDBR64
|
|
45
47
|
movq %rdi, %r11
|
|
46
48
|
pushq %rbx
|
|
47
49
|
.cfi_def_cfa rsp, 16
|
|
@@ -196,7 +198,7 @@ SYMBOL(ForwardCallXDD):
|
|
|
196
198
|
.macro trampoline id
|
|
197
199
|
.cfi_startproc
|
|
198
200
|
.cfi_def_cfa rsp, 8
|
|
199
|
-
|
|
201
|
+
ENDBR64
|
|
200
202
|
subq $152, %rsp
|
|
201
203
|
.cfi_def_cfa rsp, 160
|
|
202
204
|
movq %rdi, 0(%rsp)
|
|
@@ -209,7 +211,11 @@ SYMBOL(ForwardCallXDD):
|
|
|
209
211
|
movq %rsp, %rsi
|
|
210
212
|
leaq 160(%rsp), %rdx
|
|
211
213
|
leaq 112(%rsp), %rcx
|
|
214
|
+
#ifdef __linux__
|
|
215
|
+
call *RelayCallback@GOTPCREL(%rip)
|
|
216
|
+
#else
|
|
212
217
|
call SYMBOL(RelayCallback)
|
|
218
|
+
#endif
|
|
213
219
|
movq 112(%rsp), %rax
|
|
214
220
|
movq 120(%rsp), %rdx
|
|
215
221
|
addq $152, %rsp
|
|
@@ -222,7 +228,7 @@ SYMBOL(ForwardCallXDD):
|
|
|
222
228
|
.macro trampoline_xmm id
|
|
223
229
|
.cfi_startproc
|
|
224
230
|
.cfi_def_cfa rsp, 8
|
|
225
|
-
|
|
231
|
+
ENDBR64
|
|
226
232
|
subq $152, %rsp
|
|
227
233
|
.cfi_def_cfa rsp, 160
|
|
228
234
|
movq %rdi, 0(%rsp)
|
|
@@ -243,7 +249,11 @@ SYMBOL(ForwardCallXDD):
|
|
|
243
249
|
movq %rsp, %rsi
|
|
244
250
|
leaq 160(%rsp), %rdx
|
|
245
251
|
leaq 112(%rsp), %rcx
|
|
252
|
+
#ifdef __linux__
|
|
253
|
+
call *RelayCallback@GOTPCREL(%rip)
|
|
254
|
+
#else
|
|
246
255
|
call SYMBOL(RelayCallback)
|
|
256
|
+
#endif
|
|
247
257
|
movq 112(%rsp), %rax
|
|
248
258
|
movq 120(%rsp), %rdx
|
|
249
259
|
movsd 128(%rsp), %xmm0
|
|
@@ -328,7 +338,7 @@ SYMBOL(TrampolineX15):
|
|
|
328
338
|
SYMBOL(CallSwitchStack):
|
|
329
339
|
.cfi_startproc
|
|
330
340
|
.cfi_def_cfa rsp, 8
|
|
331
|
-
|
|
341
|
+
ENDBR64
|
|
332
342
|
push %rbx
|
|
333
343
|
.cfi_def_cfa rsp, 16
|
|
334
344
|
movq %rsp, %rbx
|
package/src/abi_x86_fwd.S
CHANGED
|
@@ -18,13 +18,15 @@
|
|
|
18
18
|
.global ForwardCallRF
|
|
19
19
|
.global ForwardCallRD
|
|
20
20
|
|
|
21
|
+
#define ENDBR32 .byte 0xf3, 0x0f, 0x1e, 0xfb
|
|
22
|
+
|
|
21
23
|
# Copy function pointer to EAX, in order to save it through argument forwarding.
|
|
22
24
|
# Also make a copy of the SP to CallData::old_sp because the callback system might need it.
|
|
23
25
|
# Save ESP in EBX (non-volatile), and use carefully assembled stack provided by caller.
|
|
24
26
|
.macro prologue
|
|
25
27
|
.cfi_startproc
|
|
26
28
|
.cfi_def_cfa esp, 4
|
|
27
|
-
|
|
29
|
+
ENDBR32
|
|
28
30
|
push %ebx
|
|
29
31
|
.cfi_def_cfa esp, 8
|
|
30
32
|
movl %esp, %ebx
|
|
@@ -125,7 +127,7 @@ ForwardCallRD:
|
|
|
125
127
|
.macro trampoline id
|
|
126
128
|
.cfi_startproc
|
|
127
129
|
.cfi_def_cfa esp, 4
|
|
128
|
-
|
|
130
|
+
ENDBR32
|
|
129
131
|
sub $44, %esp
|
|
130
132
|
.cfi_def_cfa esp, 48
|
|
131
133
|
movl $\id, 0(%esp)
|
|
@@ -153,7 +155,7 @@ ForwardCallRD:
|
|
|
153
155
|
.macro trampoline_x87 id
|
|
154
156
|
.cfi_startproc
|
|
155
157
|
.cfi_def_cfa esp, 4
|
|
156
|
-
|
|
158
|
+
ENDBR32
|
|
157
159
|
sub $44, %esp
|
|
158
160
|
.cfi_def_cfa esp, 48
|
|
159
161
|
movl $\id, 0(%esp)
|
|
@@ -260,7 +262,7 @@ TrampolineX15:
|
|
|
260
262
|
CallSwitchStack:
|
|
261
263
|
.cfi_startproc
|
|
262
264
|
.cfi_def_cfa esp, 4
|
|
263
|
-
|
|
265
|
+
ENDBR32
|
|
264
266
|
push %ebx
|
|
265
267
|
.cfi_def_cfa esp, 8
|
|
266
268
|
movl %esp, %ebx
|
package/src/call.cc
CHANGED
|
@@ -248,7 +248,7 @@ bool CallData::PushObject(Napi::Object obj, const TypeInfo *type, uint8_t *origi
|
|
|
248
248
|
} break;
|
|
249
249
|
case PrimitiveKind::Pointer: {
|
|
250
250
|
if (CheckValueTag(instance, value, member.type)) {
|
|
251
|
-
Napi::External external = value.As<Napi::External<void>>();
|
|
251
|
+
Napi::External<void> external = value.As<Napi::External<void>>();
|
|
252
252
|
void *ptr = external.Data();
|
|
253
253
|
*(void **)dest = ptr;
|
|
254
254
|
} else if (IsNullOrUndefined(value)) {
|
|
@@ -317,7 +317,7 @@ bool CallData::PushObject(Napi::Object obj, const TypeInfo *type, uint8_t *origi
|
|
|
317
317
|
if (RG_UNLIKELY(!ptr))
|
|
318
318
|
return false;
|
|
319
319
|
} else if (CheckValueTag(instance, value, member.type)) {
|
|
320
|
-
Napi::External external = value.As<Napi::External<void>>();
|
|
320
|
+
Napi::External<void> external = value.As<Napi::External<void>>();
|
|
321
321
|
ptr = external.Data();
|
|
322
322
|
} else if (IsNullOrUndefined(value)) {
|
|
323
323
|
ptr = nullptr;
|
|
@@ -452,7 +452,7 @@ bool CallData::PushNormalArray(Napi::Array array, Size len, const TypeInfo *ref,
|
|
|
452
452
|
case PrimitiveKind::Pointer: {
|
|
453
453
|
PUSH_ARRAY(CheckValueTag(instance, value, ref) || IsNullOrUndefined(value), ref->name, {
|
|
454
454
|
if (!IsNullOrUndefined(value)) {
|
|
455
|
-
Napi::External external = value.As<Napi::External<void>>();
|
|
455
|
+
Napi::External<void> external = value.As<Napi::External<void>>();
|
|
456
456
|
*(void **)dest = external.Data();
|
|
457
457
|
} else {
|
|
458
458
|
*(void **)dest = nullptr;
|
|
@@ -528,7 +528,7 @@ bool CallData::PushNormalArray(Napi::Array array, Size len, const TypeInfo *ref,
|
|
|
528
528
|
if (RG_UNLIKELY(!ptr))
|
|
529
529
|
return false;
|
|
530
530
|
} else if (CheckValueTag(instance, value, ref)) {
|
|
531
|
-
Napi::External external = value.As<Napi::External<void>>();
|
|
531
|
+
Napi::External<void> external = value.As<Napi::External<void>>();
|
|
532
532
|
ptr = external.Data();
|
|
533
533
|
} else if (IsNullOrUndefined(value)) {
|
|
534
534
|
ptr = nullptr;
|
package/src/ffi.cc
CHANGED
|
@@ -102,6 +102,8 @@ static Napi::Value GetSetConfig(const Napi::CallbackInfo &info)
|
|
|
102
102
|
if (!ChangeMemorySize(value, &instance->async_heap_size))
|
|
103
103
|
return env.Null();
|
|
104
104
|
} else if (key == "resident_async_pools") {
|
|
105
|
+
RG_STATIC_ASSERT(DefaultResidentAsyncPools <= RG_LEN(instance->memories.data));
|
|
106
|
+
|
|
105
107
|
if (!value.IsNumber()) {
|
|
106
108
|
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for resident_async_pools, expected number");
|
|
107
109
|
return env.Null();
|
|
@@ -114,7 +116,7 @@ static Napi::Value GetSetConfig(const Napi::CallbackInfo &info)
|
|
|
114
116
|
return env.Null();
|
|
115
117
|
}
|
|
116
118
|
|
|
117
|
-
|
|
119
|
+
instance->resident_async_pools = (int)n;
|
|
118
120
|
} else {
|
|
119
121
|
ThrowError<Napi::Error>(env, "Unexpected config member '%1'", key.c_str());
|
|
120
122
|
return env.Null();
|
package/test/CMakeLists.txt
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# You should have received a copy of the GNU Affero General Public License
|
|
12
12
|
# along with this program. If not, see https://www.gnu.org/licenses/.
|
|
13
13
|
|
|
14
|
-
cmake_minimum_required(VERSION 3.
|
|
14
|
+
cmake_minimum_required(VERSION 3.6)
|
|
15
15
|
project(koffi_test C CXX)
|
|
16
16
|
|
|
17
17
|
if(NOT TARGET koffi)
|
package/vendor/libcc/libcc.cc
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
#include "vendor/brotli/c/include/brotli/decode.h"
|
|
21
21
|
#include "vendor/brotli/c/include/brotli/encode.h"
|
|
22
22
|
#endif
|
|
23
|
-
#if __has_include("vendor/dragonbox/include/dragonbox/dragonbox.h")
|
|
23
|
+
#if __has_include("vendor/dragonbox/include/dragonbox/dragonbox.h") && __cplusplus >= 201703L
|
|
24
24
|
#include "vendor/dragonbox/include/dragonbox/dragonbox.h"
|
|
25
25
|
#endif
|
|
26
26
|
|
|
@@ -81,6 +81,9 @@
|
|
|
81
81
|
|
|
82
82
|
extern char **environ;
|
|
83
83
|
#endif
|
|
84
|
+
#ifdef __linux__
|
|
85
|
+
#include <sys/syscall.h>
|
|
86
|
+
#endif
|
|
84
87
|
#ifdef __APPLE__
|
|
85
88
|
#include <sys/random.h>
|
|
86
89
|
#include <mach-o/dyld.h>
|
|
@@ -3741,8 +3744,8 @@ bool ExecuteCommandLine(const char *cmd_line, FunctionRef<Span<const uint8_t>()>
|
|
|
3741
3744
|
#if defined(__OpenBSD__) || defined(__FreeBSD__)
|
|
3742
3745
|
static const pthread_t main_thread = pthread_self();
|
|
3743
3746
|
#endif
|
|
3744
|
-
static std::atomic_bool flag_interrupt
|
|
3745
|
-
static std::atomic_bool explicit_interrupt
|
|
3747
|
+
static std::atomic_bool flag_interrupt {false};
|
|
3748
|
+
static std::atomic_bool explicit_interrupt {false};
|
|
3746
3749
|
static int interrupt_pfd[2] = {-1, -1};
|
|
3747
3750
|
|
|
3748
3751
|
void SetSignalHandler(int signal, void (*func)(int), struct sigaction *prev)
|
|
@@ -4165,7 +4168,7 @@ void WaitDelay(int64_t delay)
|
|
|
4165
4168
|
|
|
4166
4169
|
WaitForResult WaitForInterrupt(int64_t timeout)
|
|
4167
4170
|
{
|
|
4168
|
-
static std::atomic_bool message
|
|
4171
|
+
static std::atomic_bool message {false};
|
|
4169
4172
|
|
|
4170
4173
|
flag_interrupt = true;
|
|
4171
4174
|
SetSignalHandler(SIGUSR1, [](int) { message = true; });
|
|
@@ -4755,8 +4758,17 @@ void FillRandomSafe(void *out_buf, Size len)
|
|
|
4755
4758
|
struct { uint32_t key[8]; uint32_t iv[2]; } buf;
|
|
4756
4759
|
|
|
4757
4760
|
memset(rnd_state, 0, RG_SIZE(rnd_state));
|
|
4758
|
-
#
|
|
4761
|
+
#if defined(_WIN32)
|
|
4759
4762
|
RG_CRITICAL(RtlGenRandom(&buf, RG_SIZE(buf)), "RtlGenRandom() failed: %s", GetWin32ErrorString());
|
|
4763
|
+
#elif defined(__linux__)
|
|
4764
|
+
{
|
|
4765
|
+
restart:
|
|
4766
|
+
int ret = syscall(SYS_getrandom, &buf, RG_SIZE(buf), 0);
|
|
4767
|
+
RG_CRITICAL(ret >= 0, "getentropy() failed: %s", strerror(errno));
|
|
4768
|
+
|
|
4769
|
+
if (ret < RG_SIZE(buf))
|
|
4770
|
+
goto restart;
|
|
4771
|
+
}
|
|
4760
4772
|
#else
|
|
4761
4773
|
RG_CRITICAL(getentropy(&buf, RG_SIZE(buf)) == 0, "getentropy() failed: %s", strerror(errno));
|
|
4762
4774
|
#endif
|
package/vendor/libcc/libcc.hh
CHANGED
|
@@ -1204,7 +1204,11 @@ public:
|
|
|
1204
1204
|
{
|
|
1205
1205
|
RemoveFrom(0);
|
|
1206
1206
|
Grow(other.capacity);
|
|
1207
|
+
#if __cplusplus >= 201703L
|
|
1207
1208
|
if constexpr(!std::is_trivial<T>::value) {
|
|
1209
|
+
#else
|
|
1210
|
+
if (true) {
|
|
1211
|
+
#endif
|
|
1208
1212
|
for (Size i = 0; i < other.len; i++) {
|
|
1209
1213
|
ptr[i] = other.ptr[i];
|
|
1210
1214
|
}
|
|
@@ -1308,7 +1312,11 @@ public:
|
|
|
1308
1312
|
Grow(count);
|
|
1309
1313
|
|
|
1310
1314
|
T *first = ptr + len;
|
|
1315
|
+
#if __cplusplus >= 201703L
|
|
1311
1316
|
if constexpr(!std::is_trivial<T>::value) {
|
|
1317
|
+
#else
|
|
1318
|
+
if (true) {
|
|
1319
|
+
#endif
|
|
1312
1320
|
for (Size i = 0; i < count; i++) {
|
|
1313
1321
|
new (ptr + len) T();
|
|
1314
1322
|
len++;
|
|
@@ -1325,7 +1333,11 @@ public:
|
|
|
1325
1333
|
Grow();
|
|
1326
1334
|
|
|
1327
1335
|
T *first = ptr + len;
|
|
1336
|
+
#if __cplusplus >= 201703L
|
|
1328
1337
|
if constexpr(!std::is_trivial<T>::value) {
|
|
1338
|
+
#else
|
|
1339
|
+
if (true) {
|
|
1340
|
+
#endif
|
|
1329
1341
|
new (ptr + len) T;
|
|
1330
1342
|
}
|
|
1331
1343
|
ptr[len++] = value;
|
|
@@ -1337,7 +1349,11 @@ public:
|
|
|
1337
1349
|
|
|
1338
1350
|
T *first = ptr + len;
|
|
1339
1351
|
for (const T &value: values) {
|
|
1352
|
+
#if __cplusplus >= 201703L
|
|
1340
1353
|
if constexpr(!std::is_trivial<T>::value) {
|
|
1354
|
+
#else
|
|
1355
|
+
if (true) {
|
|
1356
|
+
#endif
|
|
1341
1357
|
new (ptr + len) T;
|
|
1342
1358
|
}
|
|
1343
1359
|
ptr[len++] = value;
|
|
@@ -1349,7 +1365,11 @@ public:
|
|
|
1349
1365
|
{
|
|
1350
1366
|
RG_ASSERT(first >= 0 && first <= len);
|
|
1351
1367
|
|
|
1368
|
+
#if __cplusplus >= 201703L
|
|
1352
1369
|
if constexpr(!std::is_trivial<T>::value) {
|
|
1370
|
+
#else
|
|
1371
|
+
if (true) {
|
|
1372
|
+
#endif
|
|
1353
1373
|
for (Size i = first; i < len; i++) {
|
|
1354
1374
|
ptr[i].~T();
|
|
1355
1375
|
}
|
|
@@ -1655,7 +1675,11 @@ private:
|
|
|
1655
1675
|
void DeleteValues([[maybe_unused]] iterator_type begin,
|
|
1656
1676
|
[[maybe_unused]] iterator_type end)
|
|
1657
1677
|
{
|
|
1678
|
+
#if __cplusplus >= 201703L
|
|
1658
1679
|
if constexpr(!std::is_trivial<T>::value) {
|
|
1680
|
+
#else
|
|
1681
|
+
if (true) {
|
|
1682
|
+
#endif
|
|
1659
1683
|
for (iterator_type it = begin; it != end; ++it) {
|
|
1660
1684
|
it->~T();
|
|
1661
1685
|
}
|
|
@@ -1932,7 +1956,11 @@ public:
|
|
|
1932
1956
|
}
|
|
1933
1957
|
~HashTable()
|
|
1934
1958
|
{
|
|
1959
|
+
#if __cplusplus >= 201703L
|
|
1935
1960
|
if constexpr(std::is_trivial<ValueType>::value) {
|
|
1961
|
+
#else
|
|
1962
|
+
if (false) {
|
|
1963
|
+
#endif
|
|
1936
1964
|
count = 0;
|
|
1937
1965
|
Rehash(0);
|
|
1938
1966
|
} else {
|
|
@@ -2102,7 +2130,11 @@ private:
|
|
|
2102
2130
|
{ return (ValueType *)((const HashTable *)this)->Find(idx, key); }
|
|
2103
2131
|
const ValueType *Find(Size *idx, const KeyType &key) const
|
|
2104
2132
|
{
|
|
2133
|
+
#if __cplusplus >= 201703L
|
|
2105
2134
|
if constexpr(std::is_pointer<ValueType>::value) {
|
|
2135
|
+
#else
|
|
2136
|
+
if (false) {
|
|
2137
|
+
#endif
|
|
2106
2138
|
while (data[*idx]) {
|
|
2107
2139
|
const KeyType &it_key = Handler::GetKey(data[*idx]);
|
|
2108
2140
|
if (Handler::TestKeys(it_key, key))
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|