diff options
Diffstat (limited to 'gnuradio-runtime/lib/pmt/pmt_serialize.cc')
-rw-r--r-- | gnuradio-runtime/lib/pmt/pmt_serialize.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gnuradio-runtime/lib/pmt/pmt_serialize.cc b/gnuradio-runtime/lib/pmt/pmt_serialize.cc index 12a97b974c..37114139c0 100644 --- a/gnuradio-runtime/lib/pmt/pmt_serialize.cc +++ b/gnuradio-runtime/lib/pmt/pmt_serialize.cc @@ -285,14 +285,16 @@ serialize(pmt_t obj, std::streambuf &sb) } else { if(is_integer(obj)) { - long i = to_long(obj); - if(sizeof(long) > 4) { - if(i < -2147483647 || i > 2147483647) - throw notimplemented("pmt::serialize (64-bit integers)", obj); - } - ok = serialize_untagged_u8(PST_INT32, sb); - ok &= serialize_untagged_u32(i, sb); - return ok; + long i = to_long(obj); + if((sizeof(long) > 4) && ((i < -2147483647 || i > 2147483647))) { + // Serializing as 4 bytes won't work for this value, serialize as 8 bytes + ok = serialize_untagged_u8(PST_INT64, sb); + ok &= serialize_untagged_u64(i, sb); + } else { + ok = serialize_untagged_u8(PST_INT32, sb); + ok &= serialize_untagged_u32(i, sb); + } + return ok; } } @@ -566,6 +568,11 @@ deserialize(std::streambuf &sb) goto error; return from_uint64(u64); + case PST_INT64: + if(!deserialize_untagged_u64(&u64, sb)) + goto error; + return from_long(u64); + case PST_PAIR: return parse_pair(sb); |