diff options
Diffstat (limited to 'cli/pickle.hpp')
-rw-r--r-- | cli/pickle.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cli/pickle.hpp b/cli/pickle.hpp index 59af6a7b..aaecc188 100644 --- a/cli/pickle.hpp +++ b/cli/pickle.hpp @@ -162,6 +162,23 @@ public: os.put(TUPLE); } + inline void beginTuple(unsigned length) { + if (length >= 4) { + os.put(MARK); + } + } + + inline void endTuple(unsigned length) { + static const Opcode ops[4] = { + EMPTY_TUPLE, + TUPLE1, + TUPLE2, + TUPLE3, + }; + Opcode op = length < 4 ? ops[length] : TUPLE; + os.put(op); + } + inline void writeString(const char *s, size_t length) { if (!s) { writeNone(); |