diff options
author | Sverker Eriksson <[email protected]> | 2015-11-13 16:50:33 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2016-04-07 18:41:47 +0200 |
commit | 9c80b9ec06fc0ca89dcc8d797a2dbc408a162098 (patch) | |
tree | 00920702806a31febc140ebca3850622a93836ff /lib/erl_interface/src/encode/encode_ref.c | |
parent | bf0bf9cf009fa8ccc7fc364fdbbdeb6f491efe43 (diff) | |
download | otp-9c80b9ec06fc0ca89dcc8d797a2dbc408a162098.tar.gz otp-9c80b9ec06fc0ca89dcc8d797a2dbc408a162098.tar.bz2 otp-9c80b9ec06fc0ca89dcc8d797a2dbc408a162098.zip |
erl_interface: Support 32-bit creation for pid,port,refs
Diffstat (limited to 'lib/erl_interface/src/encode/encode_ref.c')
-rw-r--r-- | lib/erl_interface/src/encode/encode_ref.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/erl_interface/src/encode/encode_ref.c b/lib/erl_interface/src/encode/encode_ref.c index 0f27a086f0..956a9a7e16 100644 --- a/lib/erl_interface/src/encode/encode_ref.c +++ b/lib/erl_interface/src/encode/encode_ref.c @@ -24,6 +24,7 @@ int ei_encode_ref(char *buf, int *index, const erlang_ref *p) { + const char tag = (p->creation > 3) ? ERL_NEWER_REFERENCE_EXT : ERL_NEW_REFERENCE_EXT; char *s = buf + *index; int i; @@ -36,7 +37,7 @@ int ei_encode_ref(char *buf, int *index, const erlang_ref *p) /* Always encode as an extended reference; all participating parties are now expected to be able to decode extended references. */ if (buf) { - put8(s,ERL_NEW_REFERENCE_EXT); + put8(s, tag); /* first, number of integers */ put16be(s, p->len); @@ -45,12 +46,15 @@ int ei_encode_ref(char *buf, int *index, const erlang_ref *p) s = buf + *index; /* now the integers */ - put8(s,(p->creation & 0x03)); + if (tag == ERL_NEW_REFERENCE_EXT) + put8(s,(p->creation & 0x03)); + else + put32be(s, p->creation); for (i = 0; i < p->len; i++) put32be(s,p->n[i]); } - *index += p->len*4 + 1; + *index += p->len*4 + (tag == ERL_NEW_REFERENCE_EXT ? 1 : 4); return 0; } |