From c12f00c8b6b43d3f23851e602c66cf48b053d824 Mon Sep 17 00:00:00 2001 From: Miran Date: Thu, 1 Jul 2021 12:05:50 +0200 Subject: [PATCH] make `isLiteral` compatible with ARC and ORC (#602) (cherry picked from commit 2d4dad07165cd53e3e81af0dffb462609a93e555) --- libp2p/vbuffer.nim | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libp2p/vbuffer.nim b/libp2p/vbuffer.nim index 4da8886..d495855 100644 --- a/libp2p/vbuffer.nim +++ b/libp2p/vbuffer.nim @@ -37,10 +37,13 @@ proc len*(vb: VBuffer): int = doAssert(result >= 0) proc isLiteral[T](s: seq[T]): bool {.inline.} = - type - SeqHeader = object - length, reserved: int - (cast[ptr SeqHeader](s).reserved and (1 shl (sizeof(int) * 8 - 2))) != 0 + when defined(gcOrc) or defined(gcArc): + false + else: + type + SeqHeader = object + length, reserved: int + (cast[ptr SeqHeader](s).reserved and (1 shl (sizeof(int) * 8 - 2))) != 0 proc initVBuffer*(data: seq[byte], offset = 0): VBuffer = ## Initialize VBuffer with shallow copy of ``data``.