Skip to content

Commit 3644159

Browse files
committed
[embind] Fix signature for 64 bit types.
Long longs were incorrectly being mapped to int for the signature. Fixes #22928
1 parent 44c7540 commit 3644159

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

system/include/emscripten/bind.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,13 @@ struct SignatureCode<size_t> {
607607
}
608608
};
609609

610+
template<>
611+
struct SignatureCode<long long> {
612+
static constexpr char get() {
613+
return 'j';
614+
}
615+
};
616+
610617
#ifdef __wasm64__
611618
template<>
612619
struct SignatureCode<long> {
@@ -629,6 +636,8 @@ template<> struct SignatureTranslator<double> { using type = double; };
629636
#ifdef __wasm64__
630637
template<> struct SignatureTranslator<long> { using type = long; };
631638
#endif
639+
template<> struct SignatureTranslator<long long> { using type = long long; };
640+
template<> struct SignatureTranslator<unsigned long long> { using type = long long; };
632641
template<> struct SignatureTranslator<size_t> { using type = size_t; };
633642
template<typename PtrType>
634643
struct SignatureTranslator<PtrType*> { using type = void*; };

test/test_other.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3296,6 +3296,14 @@ def test_embind_return_value_policy(self):
32963296

32973297
self.do_runf('embind/test_return_value_policy.cpp')
32983298

3299+
@parameterized({
3300+
'': [[]],
3301+
'asyncify': [['-sASYNCIFY=1']]
3302+
})
3303+
def test_embind_bigint(self, args):
3304+
self.do_runf('embind/test_bigint.cpp', '1000000000000n\n-1000000000000n',
3305+
emcc_args=['-lembind', '-sWASM_BIGINT'] + args)
3306+
32993307
@requires_jspi
33003308
@parameterized({
33013309
'': [['-sJSPI_EXPORTS=async*']],

0 commit comments

Comments
 (0)