Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
69 lines (62 loc) · 2.38 KB

File metadata and controls

69 lines (62 loc) · 2.38 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* @license
* Copyright 2022 The Emscripten Authors
* SPDX-License-Identifier: MIT
*/
// These functions are defined once here, then included in the library below
// under two different names.
function setValueImpl(ptr, value, type = 'i8') {
if (type.endsWith('*')) type = '*';
switch (type) {
case 'i1': {{{ makeSetValue('ptr', '0', 'value', 'i1') }}}; break;
case 'i8': {{{ makeSetValue('ptr', '0', 'value', 'i8') }}}; break;
case 'i16': {{{ makeSetValue('ptr', '0', 'value', 'i16') }}}; break;
case 'i32': {{{ makeSetValue('ptr', '0', 'value', 'i32') }}}; break;
case 'i64': {{{ makeSetValue('ptr', '0', 'value', 'i64') }}}; break;
case 'float': {{{ makeSetValue('ptr', '0', 'value', 'float') }}}; break;
case 'double': {{{ makeSetValue('ptr', '0', 'value', 'double') }}}; break;
case '*': {{{ makeSetValue('ptr', '0', 'value', '*') }}}; break;
default: abort('invalid type for setValue: ' + type);
}
}
function getValueImpl(ptr, type = 'i8') {
if (type.endsWith('*')) type = '*';
switch (type) {
case 'i1': return {{{ makeGetValue('ptr', '0', 'i1') }}};
case 'i8': return {{{ makeGetValue('ptr', '0', 'i8') }}};
case 'i16': return {{{ makeGetValue('ptr', '0', 'i16') }}};
case 'i32': return {{{ makeGetValue('ptr', '0', 'i32') }}};
case 'i64': return {{{ makeGetValue('ptr', '0', 'i64') }}};
case 'float': return {{{ makeGetValue('ptr', '0', 'float') }}};
case 'double': return {{{ makeGetValue('ptr', '0', 'double') }}};
case '*': return {{{ makeGetValue('ptr', '0', '*') }}};
default: abort('invalid type for getValue: ' + type);
}
}
var LibraryMemOps = {
$setValue__docs: `
/**
* @param {number} ptr
* @param {number} value
* @param {string} type
*/`,
$setValue: setValueImpl,
$getValue__docs: `
/**
* @param {number} ptr
* @param {string} type
*/`,
$getValue: getValueImpl,
#if SAFE_HEAP
// The same as the above two functions, but known to the safeHeap pass
// in tools/acorn-optimizer.js. The heap accesses within these two
// functions will *not* get re-written.
// Note that we do not use the alias mechanism here since we need separate
// instances of above setValueImpl/getValueImpl functions.
$setValue_safe__internal: true,
$setValue_safe: setValueImpl,
$getValue_safe__internal: true,
$getValue_safe: getValueImpl,
#endif
};
mergeInto(LibraryManager.library, LibraryMemOps);
Morty Proxy This is a proxified and sanitized view of the page, visit original site.